MATLAB: Creating a scatter plot with smooth line for small dataset

MATLAB

I have a small dataset like this: x = [1 2 3 4 5]; y = [0.1 0.5 0.3 0.7 0.2];
I would like to plot them with a smooth line (not a straight line) like what we can do in Excel. Which command can do this?
Thanks in advance

Best Answer

Use spline.
xq=1:0.01:5;
s=spline(x,y,xq);
plot(x,y,'o',xq,s,'-')
Related Question