![]() |
VOOZH | about |
Cubic Spline Interpolation is a method used to draw a smooth curve through a set of given data points. Instead of connecting the points with straight lines or a single curve, it fits a series of cubic polynomials between each pair of points. These polynomials join smoothly, making the curve look natural and continuous. This technique is especially useful when we want smooth and accurate results from scattered data.
We estimate f(x) for arbitrary x, by drawing a smooth curve through the xi. If the desired x is between the largest and smallest of the xi then it is called interpolation, otherwise, it is called Extrapolation.
Linear Interpolation is a way of curve fitting the points by using linear polynomial such as the equation of the line. This is just similar to joining points by drawing a line b/w the two points in the dataset.
Polynomial Interpolation is the way of fitting the curve by creating a higher degree polynomial to join those points.
Spline interpolation similar to the Polynomial interpolation x' uses low-degree polynomials in each of the intervals and chooses the polynomial pieces such that they fit smoothly together. The resulting function is called a spline.
Given data points , the goal is to fit piecewise cubic polynomials over each interval , such that:
Let and define second derivatives at the knots as . From Taylor approximation and spline properties:
Which leads to the spline equation:
Where:
This forms a tridiagonal matrix system to solve for M0, M1, ..., Mnā. Once second derivatives Miā are known, the spline on each interval is:
Where constants and depend on and ā.
We will be using the Scipy to perform the linear spline interpolation. We will be using Cubic Spline and interp1d function of scipy to perform interpolation of function
Output: