Author:
Morris Wright
Date Of Creation:
2 April 2021
Update Date:
1 July 2024
![How to do the "Interpolation" ??](https://i.ytimg.com/vi/vmj0Ee_99qA/hqdefault.jpg)
Content
Linear interpolation, also referred to simply as interpolation or "lerping", is the ability to derive a value between two values explicitly stated in a table or graph. While many people can interpolate intuitively, the article below shows the formalized mathematical approach behind intuition.
To step
Identify the value for which you want to find a corresponding value. Interpolation can be used for something like finding a logarithm or the value of a trigonometric function, or for the corresponding gas pressure or volume at a given temperature in chemistry. Because scientific calculators have largely replaced logarithmic and trigonometric tables, we use as an example to determine an interpolated value, determining the pressure of a gas at a temperature not listed in the reference table, or as a point on a graph.
- For the equation we will derive, we represent the value for which we want to find a corresponding value as X and the interpolated value we want to find as y. We use these labels because in a chart the values we know are plotted on the horizontal or x axis, and the value we are trying to find on the vertical or y axis.
- Our Xvalue becomes the temperature of the gas (37C in this example).
Find the values closest below and above the value of x in the table or on the graph. Our reference table does not give gas pressure for 37C, but it does for 30C and 40C. The gas pressure at 30C is 3 kilopascals (kPa) and the pressure at 40C is 5 kPa.
- As we indicated with 37C X, we will indicate a temperature of 30 degrees with X1 and 40 degrees as X2.
- Because we indicate the pressure we are trying to find with y, we denote a pressure of 3 kPa at 30C with y1 and a pressure of 5 kPa at 40C with y2.
- As we indicated with 37C X, we will indicate a temperature of 30 degrees with X1 and 40 degrees as X2.
Determine the interpolated value mathematically. The equation for finding the interpolated value can be written as y = y1 + ((X - x1)/(X2 - x1) * (Y2 - y1))
- Entering the values for x, x1 and x/2 for the variables, returns (37 - 30) / (40 -30), simplifies to 7/10 or 0.7.
- Entering the values for y1 and y2 at the end of the equation gives (5 - 3) or 2.
- Multiplying 0.7 by 2 gives the product 1.4. Tel 1.4 on at y1 (or 3), gives a value of 4.4 kPa. After comparing this result with our original values, we see that 4.4 is between 3 kPa at 30C and 5 kPa at 40C, and since 37 is closer to 40 than 30, the result should be closer to 5 kPa than at 3 kPa.
- Entering the values for x, x1 and x/2 for the variables, returns (37 - 30) / (40 -30), simplifies to 7/10 or 0.7.
Tips
- If you are good at estimating distances on graphs, you can do a rough interpolation by reading the position of a point on the x axis and finding the corresponding y value. If the above example were graphed with the x-axis divided in units of 10C and the y-axis in units of 1 kPa, you could find the approximate position of 37C and then on the y-axis a search for landmark not quite half way between 4 and 5 kPa. The above equation formalizes the thinking process and gives a more exact value.
- Related to interpolation is extrapolation, where you look for a matching value for a given value outside the range of values in a table, or as shown in a graph.