15,567,786 members
2.00/5 (1 vote)
See more:
I need your help, tell me some interpolation methods. You can use C++ or C#. Thanks
Posted
Updated 25-May-10 23:04pm
v3
Comments
Stephen Hewitt 17-Feb-11 1:25am
Your question is a little vague. Can you be more specific?
Olivier Levrey 17-Feb-11 3:51am
What are you interpoling? 1D signal? 2D image?...

## Solution 1

hhxxvc wrote:
you can use c++ or c#

How about pseudo code?...

Take two points and a percentage. Calculate the distance between the two points. Calculate the distance that is the given percentage of that full distance. Now that you have that partial distance, calculate the point on the line between the two points that is the partial distance from the first point. You'll probably want to make use of a unit vector to calculate the position of the interpolated point.

## Solution 2

Hi
Interpolation is predicting data within the domain (data space). Extrapolation is predicting a point outside the domain.

Let us say a vector with two points pt1 (10,10) and pt2(20,20) p1 has temperature value 30 and pt2 has temperature value 40. So here the distance (use Pythagoras theorem to find distance) between the points also 10 units, the different between the points also 10 units. So if temperature at point 10,10 is 30 then at point 13,13 supposed to be 33. So now how you calculate this.

the point 13 has 3 unit distance from 10,10 and 7 unit distance from 20,20. The value supposed be more similar to the nearest point i.e 10,10 which value 30. So we weight the distance with a inverse relationship

tempValue1= value1* percentage of 7 unit distance i.e 30*(7/10)= 21. Note I am using the cross multiplication of the distance

tempValue2= value2* percentage of 3 unit distance i.e 40*(3/10)= 12

predicted value= tempvalue1+tempvalue2= 21+12= 33

This is a simple form of vector interpolation. Now you may search google for advanced algorithms.

good luck

## Solution 3

Hope Interpolation Methods[^] will give you an idea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 160 Richard MacCutchan 150 Rick York 110 Andre Oosthuizen 100 Richard Deeming 80
 OriginalGriff 595 Richard MacCutchan 300 Dave Kreskowiak 225 Graeme_Grant 203 k5054 120

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900