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

Write a MATLAB script entitled “CosWave.m” that plots y=cos(x) using a linearly

ID: 3009948 • Letter: W

Question

Write a MATLAB script entitled “CosWave.m” that plots y=cos(x) using a linearly spaced x-vector generated with the “linspace” function (do not use a “for” loop). Plot with a range from x=0 to x=4*pi with 100 points, using black circles and a black dashed line. Label the plot title “Cosine Wave,” label the x-axis “Independent Variable,” and label the y-axis “Dependent Variable.” Initialize variables and add comments on each line that explains their purpose. Turn in (i) the script, as well as (ii) an image of the plot.

Explanation / Answer

Here goes the script inside the function CosWave.m

x = linespace(0, 4*pi)

y = sin(x)

figure

plot(x,y,'--ko') % -- is for dashed line k is for black color o is for circle

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