![]() ![]() If you want to plot the points itself, use LineSpec-syntax when calling plot like this 1: plot(x,y,'*') ġ) Other types of points are possible as well, see the above linked documentation. Note that y is a vector as well as x and that y(n) equals to sin(x(n)) for all n. So the following code does probably what you want: x = linspace(0,2*pi,100) In that case no for-loop is needed because you can calculate and plot vectors directly in MATLAB. I assume you meant to draw a continuous line. Solution 1: Vectorized calculation and direct plot With plot(x(i),y) you are plotting 100 single points (one in each iteration) and they are not shown by default.
0 Comments
Leave a Reply. |