## Interpolation methods Consider N height samples, that is, we have N triples x iy i ,z i. We want to estimate the height z given a position on the plane x,y. The general form of the so called "nearest neighbour weighted interpolation" also sometimes called the "inverse distance method" for estimating z is given by the following. Note the denominator above gives a measure of how close the point being estimated is from the samples. Naturally if a sample is close then it has a greater influence on the estimate than if the sample is distant.

The following shows an example of reconstructing a surface from samples. The approximation is generally better with increased values of p.

## Interpolation

The original surface from which samples are taken for this example is shown on the right. The most common application of this is smooth rendering of surfaces approximated by a finite number of triangular facets or quadrilaterals.

The following illustrates a part of a sphere made up of quadrilaterals and rendered using a single normal applied to the whole face or 4 normals at each vertex interpolated across the face.

The approach most commonly used by 3D rendering packages, both real-time such as OpenGL and more CPU intensive algorithms such as raytracing, is called Phong normal interpolation. A often used efficient implementation is called barycentric interpolation. The idea is the same for both colour and normal interpolation, a line is extended from the point in question to two edges of the polygon.

The estimate of the colour or normal at those points is made by linear interpolation between the values at the vertices of the edge. The estimate at the point in question is linearly interpolated from the estimates at the ends of the extended line.

This is illustrated in the sequence below, while this is for normals the method is identical for colours which are after all generally a r,g,b triple instead of a x,y,z triple. In A the point P is where the colour or normal is to be estimated, a line is extended in any direction but shown as horizontal in this diagram until it intersects two edges. In B the normals at the intersection points of the extended line are shown in red, they are calculated by linear interpolation.

In C the two normals in B are linearly interpolated to give the estimate of the normal at point P.

## Choosing the Right Interpolation Method

Note The colour or normal estimate at the vertices is always the same as the vertex value. The colour or normals along the edges only depends on the colour or normal at the edge vertices and not on the values at the other vertices.

It is this that ensures that adjacent faces with the same colour or normal along a joining edge will join smoothly even though their other vertices may have very different values. The direction in which the line is extended out from the point being estimated doesn't matter except that it must be the same for all points within a face.

One way is to choose a major axis by specifying a normal. The plane with this normal that passes though the point in question cuts two of the polygon edges, this is used as the extended line. One difference between interpolation of normals and colours is that the normals estimated at the end of the extended lines and the final normal at P are normalised to unit length.

In colour interpolation each r,g,b component is treated independently. Normal interpolated across face.Extrapolation and interpolation are both used to estimate hypothetical values for a variable based on other observations. There are a variety of interpolation and extrapolation methods based on the overall trend that is observed in the data. These two methods have names that are very similar.

We will examine the differences between them. For both methods, we assume a few things. We have identified an independent variable and a dependent variable. Through sampling or a collection of data, we have a number of pairings of these variables.

We also assume that we have formulated a model for our data. This may be a least squares line of best fit, or it could be some other type of curve that approximates our data. In any case, we have a function that relates the independent variable to the dependent variable.

The goal is not just the model for its own sake, we typically want to use our model for prediction. More specifically, given an independent variable, what will the predicted value of the corresponding dependent variable be? The value that we enter for our independent variable will determine whether we are working with extrapolation or interpolation. We could use our function to predict the value of the dependent variable for an independent variable that is in the midst of our data.

In this case, we are performing interpolation. Because our x value is among the range of values used to make the line of best fit, this is an example of interpolation. We could use our function to predict the value of the dependent variable for an independent variable that is outside the range of our data. In this case, we are performing extrapolation. Because our x value is not among the range of values used to make the line of best fit, this is an example of extrapolation.

Of the two methods, interpolation is preferred. This is because we have a greater likelihood of obtaining a valid estimate. When we use extrapolation, we are making the assumption that our observed trend continues for values of x outside the range we used to form our model. This may not be the case, and so we must be very careful when using extrapolation techniques. Share Flipboard Email. Courtney Taylor. Professor of Mathematics. Courtney K. Taylor, Ph. Definition and Examples of Independent and Dependent Variables.In the mathematical field of numerical analysisinterpolation is a type of estimationa method of constructing new data points within the range of a discrete set of known data points. In engineering and scienceone often has a number of data points, obtained by sampling or experimentationwhich represent the values of a function for a limited number of values of the independent variable.

It is often required to interpolatei. A closely related problem is the approximation of a complicated function by a simple function. Suppose the formula for some given function is known, but too complicated to evaluate efficiently. A few data points from the original function can be interpolated to produce a simpler function which is still fairly close to the original. The resulting gain in simplicity may outweigh the loss from interpolation error.

We describe some methods of interpolation, differing in such properties as: accuracy, cost, number of data points needed, and smoothness of the resulting interpolant function.

The simplest interpolation method is to locate the nearest data value, and assign the same value. In simple problems, this method is unlikely to be used, as linear interpolation see below is almost as easy, but in higher-dimensional multivariate interpolationthis could be a favourable choice for its speed and simplicity.

NEWTON BACKWARD INTERPOLATION - Secret Tips & Tricks - NUMERICAL METHOD - TUTORIAL - 2

One of the simplest methods is linear interpolation sometimes known as lerp. Consider the above example of estimating f 2. Since 2. Generally, linear interpolation takes two data points, say x ay a and x by band the interpolant is given by:. Linear interpolation is quick and easy, but it is not very precise. Another disadvantage is that the interpolant is not differentiable at the point x k.

The following error estimate shows that linear interpolation is not very precise. Denote the function which we want to interpolate by gand suppose that x lies between x a and x b and that g is twice continuously differentiable. Then the linear interpolation error is. In words, the error is proportional to the square of the distance between the data points.

The error in some other methods, including polynomial interpolation and spline interpolation described belowis proportional to higher powers of the distance between the data points. These methods also produce smoother interpolants. Polynomial interpolation is a generalization of linear interpolation. Note that the linear interpolant is a linear function. We now replace this interpolant with a polynomial of higher degree.

Consider again the problem given above. The following sixth degree polynomial goes through all the seven points:. The interpolation error is proportional to the distance between the data points to the power n.

Furthermore, the interpolant is a polynomial and thus infinitely differentiable. So, we see that polynomial interpolation overcomes most of the problems of linear interpolation. However, polynomial interpolation also has some disadvantages. Calculating the interpolating polynomial is computationally expensive see computational complexity compared to linear interpolation.

Furthermore, polynomial interpolation may exhibit oscillatory artifacts, especially at the end points see Runge's phenomenon. Polynomial interpolation can estimate local maxima and minima that are outside the range of the samples, unlike linear interpolation. However, these maxima and minima may exceed the theoretical range of the function—for example, a function that is always positive may have an interpolant with negative values, and whose inverse therefore contains false vertical asymptotes.

More generally, the shape of the resulting curve, especially for very high or low values of the independent variable, may be contrary to commonsense, i. These disadvantages can be reduced by using spline interpolation or restricting attention to Chebyshev polynomials. Spline interpolation uses low-degree polynomials in each of the intervals, and chooses the polynomial pieces such that they fit smoothly together.Interpolation is a statistical method by which related known values are used to estimate an unknown price or potential yield of a security.

Interpolation is a method of estimating an unknown price or yield of a security. This is achieved by using other related known values that are located in sequence with the unknown value.

### Select a Web Site

Interpolation is at root a simple mathematical concept. If there is a generally consistent trend across a set of data points, one can reasonably estimate the value of the set at points that haven't been calculated. However, this is at best an estimate; interpolators can never offer complete confidence in their predictions. There are several formal kinds of interpolation, including linear interpolation, polynomial interpolation, and piecewise constant interpolation.

The easiest and most prevalent kind is a linear interpolation, which is useful if one is trying to estimate the value of a security or interest rate for a point at which there is no data. Let's assume that, for a security price being tracked over a period of time, we call the line on which the value of the security is tracked the function f x.

The current price of a stock is plotted over a series of points representing moments in time. So if f x is recorded for August, October, and December, those points would be mathematically represented as x Aug, x Oct, and x Dec, or x 1, x 3 and x 5. For a number of reasons, one might want to know the value of security during September. You can use a linear interpolation algorithm to determine the value of f x at plot point x Sepor x 2 that appears within the existing data range.

Interpolation should not be confused with extrapolationby which one could estimate a data point outside of the known range of data. Most charts representing a stock's history are in fact widely interpolated. Linear regression is used to make the curves which approximately represent the price variations of a security. Even if a chart measuring a stock over a year included data points for every day of the year, one could never say with complete confidence where a stock will have been valued at a specific moment in time.

Interpolation is fairly simple, but it lacks precision. Interpolation has been used by human civilizations since antiquity, particularly by early astronomers in Mesopotamia and Asia Minor attempting to fill in gaps the observation possibilities for astronomers being inherently limited. While the movement of planetary bodies is subject to many factors, they are still better suited to the imprecision of interpolation than the wildly variant, unpredictable fluctuations of publicly-traded stocks.

Nevertheless, with the overwhelming mass of data involved in securities analysis, large interpolations of price movements are fairly unavoidable. Portfolio Management. Tools for Fundamental Analysis. Technical Analysis Basic Education. Fundamental Analysis.Interpolation is the process of using points with known values or sample points to estimate values at other unknown points. It can be used to predict unknown values for any geographic point data, such as elevation, rainfall, chemical concentrations, noise levels, and so on.

The available interpolation methods are listed below. The Inverse Distance Weighting interpolator assumes that each input point has a local influence that diminishes with distance. It weights the points closer to the processing cell greater than those further away. A specified number of points, or all points within a specified radius can be used to determine the output value of each location.

Use of this method assumes the variable being mapped decreases in influence with distance from its sampled location. The Inverse Distance Weighting IDW algorithm effectively is a moving average interpolator that is usually applied to highly variable data. For certain data types it is possible to return to the collection site and record a new value that is statistically different from the original reading but within the general trend for the area.

The interpolated surface, estimated using a moving average technique, is less than the local maximum value and greater than the local minimum value. IDW interpolation explicitly implements the assumption that things that are close to one another are more alike than those that are farther apart.

To predict a value for any unmeasured location, IDW will use the measured values surrounding the prediction location. Those measured values closest to the prediction location will have more influence on the predicted value than those farther away.

Thus, IDW assumes that each measured point has a local influence that diminishes with distance. The IDW function should be used when the set of points is dense enough to capture the extent of local surface variation needed for analysis. IDW determines cell values using a linear-weighted combination set of sample points. The IDW technique calculates a value for each grid node by examining surrounding data points that lie within a user-defined search radius.

Some or all of the data points can be used in the interpolation process. The node value is calculated by averaging the weighted sum of all the points. Data points that lie progressively farther from the node influence the computed value far less than those lying closer to the node. A radius is generated around each grid node from which data points are selected to be used in the calculation.

Natural neighbor interpolation has many positive features, can be used for both interpolation and extrapolation, and generally works well with clustered scatter points. Another weighted-average method, the basic equation used in natural neighbor interpolation is identical to the one used in IDW interpolation.

This method can efficiently handle large input point datasets. When using the Natural Neighbor method, local coordinates define the amount of influence any scatter point will have on output cells. The Natural Neighbour method is a geometric estimation technique that uses natural neighbourhood regions generated around each point in the data set.

Like IDW, this interpolation method is a weighted-average interpolation method. This method is most appropriate where sample data points are distributed with uneven density.

It is a good general-purpose interpolation technique and has the advantage that you do not have to specify parameters such as radius, number of neighbours or weights. This technique is designed to honour local minimum and maximum values in the point file and can be set to limit overshoots of local high values and undershoots of local low values. The method thereby allows the creation of accurate surface models from data sets that are very sparsely distributed or very linear in spatial distribution. Spline estimates values using a mathematical function that minimizes overall surface curvature, resulting in a smooth surface that passes exactly through the input points.

Conceptually, it is analogous to bending a sheet of rubber to pass through known points while minimizing the total curvature of the surface. It fits a mathematical function to a specified number of nearest input points while passing through the sample points. This method is best for gently varying surfaces, such as elevation, water table heights, or pollution concentrations.

The Spline method of interpolation estimates unknown values by bending a surface through known values. A Regularized method creates a smooth, gradually changing surface with values that may lie outside the sample data range.

It incorporates the first derivative slopesecond derivative rate of change in slopeand third derivative rate of change in the second derivative into its minimization calculations. A surface created with Spline interpolation passes through each sample point and may exceed the value range of the sample point set.Design by Provoq. Contact Us.

Assume we are dealing with a variable which has meaningful values at every point within a region e. Then, given the values of that variable at a set of sample points, we can use an interpolation method to predict values of this variable at every point For any unknown point, we take some form of weighted average of the values at surrounding points to predict the value at the point where the value is unknown In other words, we create a continuous surface from a set of points As an example used throughout this presentation, imagine we have data on the concentration of gold in western Pennsylvania at a set of sample locations:.

Interpolation should not be used when there isn't a meaningful value of the variable at every point in space within the region of interest That is, when points represent merely the presence of events e.

Interpolation is prediction within the range of our data E. A computer movie simulating urban growth in the Detroit region. Economic Geography, 46 2 : Deterministic methods Use mathematical functions to calculate the values at unknown locations based either on the degree of similarity e.

IDW or the degree of smoothing e. Interpolators can be either exact or inexact At sampled locations, exact interpolators yield values identical to the measurements i. Kriging can be exact or inexact Reference: Burrough, P. Principles of geographical information systems. Oxford University Press, Oxford. To predict a value for any unmeasured location, IDW will use the measured values surrounding the prediction location.

Measured values that are nearest to the prediction location will have greater influence i. As a result, as the distance increases, the weights decrease rapidly. The specified shape of the neighborhood restricts how far and where to look for the measured values to be used in the prediction. Other neighborhood parameters restrict the locations that will be used within that shape The output surface is sensitive to clustering and the presence of outliers.

Points with known values of elevation that are outside the circle are just too far from the target point at which the elevation value is unknown, so their weights are pretty much 0. One way to assess the accuracy of the interpolation is known as cross-validation Remember the initial goal: use all the measured points to create a surface However, assume we remove one of the measured points from our input, and re-create the surface using all the remaining points Now, we can look at the predicted value at that removed point and compare it to the point's actual value!

We do the same thing for all points If the average squared difference between the actual value and the prediction is small, then our model is doing a good job at predicting values at unknown points. If this average squared difference is large, then the model isn't that great.

This average squared difference is called mean square error of prediction. For instance, the Geostatistical Analyst of ESRI reports the square root of this average squared difference Cross-validation is used in other interpolation methods as well.

Assume you have measurements at 15 data points, from which you want to create a prediction surface The Measured column tells you the measured value at that point. The Predicted column tells you the prediction at that point when we remove it from the input i. The Error column is simply the difference between the measured and predicted values Because we can have an over-prediction or under-prediction at any point, the error can be positive or negative.

So averaging the errors won't do us much good if we want to see the overall error, we'll end up with a value that is essentially zero due to these positives and negatives Thus, in order to assess the extent of error in our prediction, we square each term, and then take the average of these squared errors. This root mean square error is often denoted as RMSE. Larger q's i. A lot of statistical tests including many in geostatistics rely on the assumption that data is normally distributed When this assumption does not hold, the results are often inaccurate.

Sometimes, it is possible to transform a variable's distribution by subjecting it to some simple algebraic operation The logarithmic transformation is the most widely used to achieve normality when the variable is positively skewed as in the image on the left below Analysis is then performed on the transformed variable. Defined as a measure of how much two variables X and Y change together The units of Cov X, Y are those of X multiplied by those of Y The covariance of a variable X with itself is simply the variance of X Since these units are fairly obscure, a dimensionless measure of the strength of the relationship between variables is often used instead.

This measure is known as the correlation Correlations range from -1 to 1, with positive values close to one indicating a strong direct relationship and negative values close to -1 indicating a strong inverse relationship. A statistical method used to examine the relationship between a variable of interest and one or more explanatory variables Strength of the relationship Direction of the relationship Often referred to as Ordinary Least Squares OLS regression Available in all statistical packages Note that the presence of a relationship does not imply causality.

Variable of interest dependent variable E. An example with a single predictor:. R-squared: the percent of variance in the dependent variable that is explained by the independent variables The so-called p-value of the coefficient The probability of getting a coefficient slope value as far from zero as we observe in the case when the slope is actually zero When p is less than 0.

The dependent variable should be normally distributed i.Image interpolation occurs in all digital photos at some stage — whether this be in bayer demosaicing or in photo enlargement. It happens anytime you resize or remap distort your image from one pixel grid to another. Image resizing is necessary when you need to increase or decrease the total number of pixels, whereas remapping can occur under a wider variety of scenarios: correcting for lens distortion, changing perspective, and rotating an image.

Even if the same image resize or remap is performed, the results can vary significantly depending on the interpolation algorithm. Itis only an approximation, therefore an image will always lose some quality each time interpolation is performed.

This tutorial aims to provide a better understanding of how the results may vary — helping you to minimize any interpolation-induced losses in image quality. Interpolation works by using known data to estimate values at unknown points. For example: if you wanted to know the temperature at noon, but only measured it at 11AM and 1PM, you could estimate its value by performing a linear interpolation:. If you had an additional measurement at AM, you could see that the bulk of the temperature rise occurred before noon, and could use this additional data point to perform a quadratic interpolation:.

The more temperature measurements you have which are close to noon, the more sophisticated and hopefully more accurate your interpolation algorithm can be. Image interpolation works in two directions, and tries to achieve a best approximation of a pixel's color and intensity based on the values at surrounding pixels.

Unlike air temperature fluctuations and the ideal gradient above, pixel values can change far more abruptly from one location to the next. As with the temperature example, the more you know about the surrounding pixels, the better the interpolation will become. Therefore results quickly deteriorate the more you stretch an image, and interpolation can never add detail to your image which is not already present. Interpolation also occurs each time you rotate or distort an image.

The previous example was misleading because it is one which interpolators are particularly good at. This next example shows how image detail can be lost quite rapidly:. Note how most of the detail is lost in just the first rotation, although the image continues to deteriorate with successive rotations. One should therefore avoid rotating your photos when possible ; if an unleveled photo requires it, rotate no more than once.

The above results use what is called a "bicubic" algorithm, and show significant deterioration. Note the overall decrease in contrast evident by color becoming less intense, and how dark haloes are created around the light blue. The above results could be improved significantly, depending on the interpolation algorithm and subject matter.

Common interpolation algorithms can be grouped into two categories: adaptive and non-adaptive. Adaptive methods change depending on what they are interpolating sharp edges vs. Non-adaptive algorithms include: nearest neighbor, bilinear, bicubic, spline, sinc, lanczos and others.

Depending on their complexity, these use anywhere from 0 to or more adjacent pixels when interpolating. The more adjacent pixels they include, the more accurate they can become, but this comes at the expense of much longer processing time.

These algorithms can be used to both distort and resize a photo. Adaptive algorithms include many proprietary algorithms in licensed software such as: Qimage, PhotoZoom Pro, Genuine Fractals and others.

Many of these apply a different version of their algorithm on a pixel-by-pixel basis when they detect the presence of an edge — aiming to minimize unsightly interpolation artifacts in regions where they are most apparent. These algorithms are primarily designed to maximize artifact-free detail in enlarged photos, so some cannot be used to distort or rotate an image. Nearest neighbor is the most basic and requires the least processing time of all the interpolation algorithms because it only considers one pixel — the closest one to the interpolated point.

This has the effect of simply making each pixel bigger. Bilinear interpolation considers the closest 2x2 neighborhood of known pixel values surrounding the unknown pixel.