Question

Problem-8: Programming in MATLAB (there are two parts, 8a and 8b, each worth 6 points). NOTE:

Throughout the semester, whenever you generate plot(s) in MATLAB, please include appropriate x, y label,

title and legend (if needed). You must submit the mfile, answers from the command window, and figure(s).

One way to do this is to copy your code, figures and answers from command window and paste it on a word

document. Then scan this document along with the rest of your work.

8a. Plot the function, y = 10cos(x)/x for the range 1 ≤ x ≤ 10 using a) fplot and b) "for" loop function. Have both

the plots on the same graph. Refer example-1 in manual.

8b. Refer Problem-1/ part-1. Using ode45 function, solve the first order ODE and plot y(t) for 0 ≤t≤ 5 seconds.

Use time steps = 0.001 seconds and y(0) = 0. Refer example-2 in manual.

Question image 1