MATLAB: Curve of best fit from a few points

curve fittingMATLAB

I have these points: –
x=[1 1.5 2 2.5 3];
y=[19.74 14.26 12.34 11.45 10.97];
and I know I can do a very rough approximation of a curve of best fit simply by "joining the dots" using: –
plot(x,y)
but is there a way to get MATLAB to join them using a curve of best fit?
I'm not sure exactly how to define 'curve of best fit', but I suppose an example might be if one had a string of x-values (+ & -) and each one had a corresponding y-value that was just x^2, then a curve of best fit for those points would show the get close to showing the curve y=x^2.
I obviously don't know the equation of my curve, which I guess is one of the issues that requires a certain method to be adopted over another.

Best Answer

x=[1 1.5 2 2.5 3];
y=[19.74 14.26 12.34 11.45 10.97];
xi=1:0.2:3
method='spline'
yi=interp1(x,y,xi,method)
plot(xi,yi)