how I can do interpolation in simple way ?
for example if I have many values of x and y
x1= 0.2 y1=0.6
x2= 0.3 y2=0.8
![]() |
how I can do interpolation in simple way ?
for example if I have many values of x and y
x1= 0.2 y1=0.6
x2= 0.3 y2=0.8
There are many ways, with varying degrees of accuracy and smoothness, depending upon the function being interpolated.
The most common way (and one of the simplest) is piecewise-linear interpolation. That means that you connect adjacent points with a straight line. The resulting curve is continuous, but it's first derivative is not (the slope changes instantaneously at each known point).
Polynomial interpolation uses higher-order functions, so that the points are connected with smooth curves. If an (n-1)th-order polynomial is used, a function can be found which passes through all the points and has continuous derivatives. However, such functions can sometimes deviate wildly in between known points. It can also be difficult or memory-intensive to calculate the polynomial coefficients if the number of known points is large.
Another really common technique is called spline interpolation. This is sort of a hybrid of the first two. A low-order (usually cubic) polynomial is used to describe the function between two points. The polynomial coefficients are chosen such that not only does the resulting function pass through the two points on either side, it also has the same slope (first derivative) at the endpoints as the polynomials describing the intervals on either side.
This wikipedia article actually does a very good job of showing the different types.
All times are GMT -7. The time now is 11:01 PM. |