Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Create a function, PlotSC, which receives two input values acting as the range to be plotted, (a,b). There will be no variable/numerical output from this function.

1 vue (au cours des 30 derniers jours)
lsd ye
lsd ye le 24 Oct 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
Within the function, plot y = sin(x) + cos(x) for x values ranging from a to b (in the same figure window): a. Using 5 points in this range and a solid blue line with circles. b. Using 10 points in this range and a dashed-dotted black line with squares. c. Using 50 points in this range and a dashed red line with stars. Still within your function, title your plot ‘y vs. x’, label both axes as ‘x’ and ‘y’, respectively, and add a legend.
My code is function PlotSC(a,b) a=-2*pi b=2*pi x=linspace(a,b); y=sin(x)+cos(x); plot(x,y,'b')
but i dont know how to use 5, 10, 50 points.

Réponses (2)

the cyclist
the cyclist le 24 Oct 2014
You might find the linspace function to be handy.

Star Strider
Star Strider le 24 Oct 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by