Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a) Using the linspace function create an array called X of length 500 ranging in

ID: 3542386 • Letter: A

Question

a) Using the linspace function create an array called X of length 500 ranging in value from 0 to

4?.


b) Create an array called Y who's values correspond to the sine of the values in X.


c) Create an array called Z who's values correspond to the sine of the square of the values in X.


d) Plot Y vs. X, and Z vs. X on the same axis using the plot command. Make the Y vs. X line a

dashed red line and Z vs. X a solid blue line with circular markers at each data point. Create

a legend which identifies which line is which. Create a title for this figure with the text

Explanation / Answer

%%%%%(a)

X = linspace(0,4*pi,500);


%%%%(b)

Y = sin(X);


%%%%(c)

Z = sin(X.^2);


%%%%(d)

plot(X,Y,'r--')

hold

plot(X,Z,'b')

hold

legend('Y vs X','Z vs X');

title('Part 2d')

grid on

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote