Project - Data Handling and Interpolation
Aim
- In this project we are reading the excel file into matlab programm.
- Perform the interpolation in the range of -17.3:0.1:0.9
- Generate the interactive plot for the interpolated data and store them in text file.
First we deal with theoratical information about the interpolation
What is interpolation.
Interpolation is a method of fitting the data points to represent the value of a function. It has various applications in engineering and science, that are used to construct new data points within the range of a discrete data set of known data points or can be used for determining a formula of the function that will pass from the given set of points (x,y).
Interpolation type.
- Linear Interpolation
- Spline interpolation
- Cubic spline interpolation
- Polynomial interpolation
- Mimetic interpolation
- Nearest neighbour interpolation
Linear interpolation
Linear interpolation is a simple method for estimating a value within a range based on two known values. It is commonly used in various fields, such as mathematics, computer graphics, data analysis, and engineering. The process involves fitting a straight line between two data points and using that line to predict the value at an intermediate point.
y = y1 + (x - x1) * ((y2 - y1) / (x2 - x1))
Spline interpolation
Spline interpolation is a more advanced method of estimating values between data points. Unlike linear interpolation, which uses straight lines to connect data points, spline interpolation uses piecewise-defined polynomials to create a smooth curve that passes through all the data points.
Cubic spline interpolation
Cubic spline interpolation is a specific type of spline interpolation that uses cubic polynomials to create a smooth curve passing through the given data points. It is widely used in various fields like computer graphics, engineering, data analysis, and numerical methods.
To perform cubic spline interpolation, you follow these steps:
- Given a set of data points (xi, yi), where i = 0, 1, ..., n (with xi sorted in ascending order), calculate the coefficients for each cubic polynomial segment.
- For each segment between points (xi, yi) and (xi+1, yi+1), you define a cubic polynomial in the form:
- Si(x) = ai + bi * (x - xi) + ci * (x - xi)^2 + di * (x - xi)^3
- where
ai,bi,ci, anddiare the coefficients specific to that segment. - Once you have the coefficients for each segment, the cubic spline function is fully defined, and you can use it to interpolate values within the data range.
Polynomial Interpolation
Polynomial interpolation is a mathematical technique used to approximate a function by fitting a polynomial through a set of given data points. The goal of polynomial interpolation is to find a polynomial of degree n that passes through n+1 data points (xi, yi) exactly.
The general form of a polynomial of degree n is:
P(x) = a0 + a1 * x + a2 * x^2 + ... + an * x^n
To perform polynomial interpolation, follow these steps:
- Given a set of data points (xi, yi), where i = 0, 1, ..., n, with xi sorted in ascending order, determine the number of data points (n+1) you have and the degree of the polynomial you want to use for the interpolation (typically equal to n).
- Set up a system of n+1 equations using the data points, where each equation corresponds to one data point and involves the unknown coefficients
a0, a1, ..., an. - Solve the system of equations to find the specific values of
a0, a1, ..., an, which define the polynomial that passes through the given data points. - Once you have the coefficients of the polynomial, you can use the resulting polynomial function
P(x)to interpolate values within the data range or to approximate the function for values outside the data range.
Mimetic interpolation
mimetic interpolation is a method for interpolating differential forms. In contrast to other interpolation methods, which estimate a field at a location given its values on neighboring points, mimetic interpolation estimates the field's k{\displaystyle k} Kk-form given the field's projection on neighboring grid elements. The grid elements can be grid points as well as cell edges or faces, depending on k=0,1,2, 3…{\displaystyle k=0,1,2,\cdots }.
Mimetic interpolation is particularly relevant in the context of vector and pseudo-vector fields as the method conserves line integrals and fluxes, respectively
Nearest neighbour interpolation
Interpolation is the problem of approximating the value of a function for a non-given point in some space when given the value of that function in points around (neighboring) that point. The nearest neighbor algorithm selects the value of the nearest point and does not consider the values of neighboring points at all, yielding a piecewise-constant interpolant.
Matlab Code