Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
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 22: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?...

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.
 
Share this answer
 
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
 
Share this answer
 
Hope Interpolation Methods[^] will give you an idea.
 
Share this answer
 

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



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