MATLAB: Continuous plot(x,y) for discrete data points

continuous plotplot

When using plot(x,y) function, [say for example x = 1X20 matrix and y=sin(x), which means that there are only 20 data points), matlab plot comes out to be a continuous one. Is this always the case? I just started using matlab.

Best Answer

You can use plot for continuous plot, or stem function for discrete plot. You can also use scatter function
Example
x=0:10
y=sin(x)
plottx,y);
figure
stem(x,y);
figure
scatter(x,y)
Related Question