Curve fitting is a technique of finding an algebraic relationship that “best” fits a given set of data.
Unfortunately, there is no magical function (in MATLAB or otherwise) that can give you this relationship if you simply supply the data.
You have to have an idea of what kind of relationship might exist between the input data (xi) and the output data (yi).
However, if you do not have a firm idea but you have data that you trust, MATLAB can help you in exploring the best possible fit.
MATLAB 6 includes Basic Fitting in its Figure window’s Tools menu that lets you fit a polynomial curve (up to 10th order) to your data on a fly.
It also gives you options of displaying the residual at the data points and computing the norm of the residuals.
This can help in comparing different fits and then selecting the one that makes you happy.
Let us take an example and go through the steps.