# Curve Fitting Using Polynomial Interpolation

by admin in Curve Fitting , Interpolation , Math, Statistics, and Optimization , MATLAB Family on April 26, 2019This code fits a Curve to a given points using the Polynomial Interpolation method of second order, where you need just to input the X and Y point that needed to be fitted.

### Code Outputs:

- Chart Presents the Given Points and the Resultant Polynomial Fitted Curve
- The Fitted Y Values of any inserted X Points, Vector or Scalar.

Interpolated Value for Xi = 20.0062

### Input Requirements:

- X Points
- Y Points
- Xi the value you want to interpolate

### About The Method:

**Polynomial interpolation** is the interpolation of a given data set by the polynomial of lowest possible degree that passes through the points of the dataset

Polynomial interpolation is also essential to perform sub-quadratic multiplication and squaring such as Karatsuba multiplication and Toom–Cook multiplication, where an interpolation through points on a polynomial which defines the product yields the product itself. For example, given ** a = f(x) = a_{0}x^{0} + a_{1}x^{1} + …** and

**the product**

*b*=*g*(*x*) =*b*_{0}*x*^{0}+*b*_{1}*x*^{1}+ …,*ab*is equivalent to

**. Finding points along**

*W*(*x*) =*f*(*x*)*g*(*x*)**by substituting**

*W*(*x*)*x*for small values in

**and**

*f*(*x*)**yields points on the curve. Interpolation based on those points will yield the terms of**

*g*(*x*)**and subsequently the product**

*W*(*x*)*ab*. In the case of Karatsuba multiplication this technique is substantially faster than quadratic multiplication, even for modest-sized inputs. This is especially true when implemented in parallel hardware.

### Definition:

Given a set of ** n + 1** data points

**(**where no two

*x*,_{i}*y*)_{i}*x*are the same, one is looking for a polynomial p of degree at most n with the property

_{i}The unisolvence theorem states that such a polynomial *p* exists and is unique, and can be proved by the Vandermonde matrix, as described below.

The theorem states that for ** n + 1 **interpolation nodes

**(**, polynomial interpolation defines a linear bijection

*x*)_{i}where** Π _{n}** is the vector space of polynomials (defined on any interval containing the nodes) of degree at most

**n**.

### Constructing the interpolation polynomial:

Suppose that the interpolation polynomial is in the form

The statement that *p* interpolates the data points means that

If we substitute equation (1) in here, we get a system of linear equations in the coefficients** a_{k}**. The system in matrix-vector form reads the following multiplication:

We have to solve this system for** a_{k}** to construct the interpolant

**. The matrix on the left is commonly referred to as a Vandermonde matrix.**

*p*(*x*)The condition number of the Vandermonde matrix may be large, causing large errors when computing the coefficients ** a_{i}** if the system of equations is solved using Gaussian elimination.

Several authors have therefore proposed algorithms which exploit the structure of the Vandermonde matrix to compute numerically stable solutions in **O( n^{2})** operations instead of the

**O(**required by Gaussian elimination. These methods rely on constructing first a Newton interpolation of the polynomial and then converting it to the monomial form above.

*n*^{3})Alternatively, we may write down the polynomial immediately in terms of Lagrange polynomials:

For matrix arguments, this formula is called Sylvester’s formula and the matrix-valued Lagrange polynomials are the Frobenius covariants.

Share Now!