Least square regression is a good choice for experimental data having inherent error. In the most of cases, curves obtained by least square method don’t pass through the main points. In some cases the main points are exact and it is desired that the fitted curve passes through the main points. In this situation, interpolation methods are the best choices for curve fitting. Mathematically, it can be shown that for there is one and only one polynomial that pass through all the points. This polynomial can be written as follows:
There are several techniques to find this polynomial. Lagrange interpolating method is one of the simplest ways to find the interpolating polynomial. This method can be presented as follows: For any arbitrary
n+1 points [x] the related polynomial which passes through all the points is:_{i },f(x_{i})
where,
The algorithm of the Lagrange interpolating method can be written as follows:
Step 5: if i and j are not equal then letStep 6: f = f + s f(x
_{i})
Curve Fitting (Source Code in C++) |

About Numerical Methods > Curve Fitting >