Archived

This topic is now archived and is closed to further replies.

Obtainchi

Interpolation Understanding

Recommended Posts

float linearInterpolate(float p1,float p2,float mu)
{
   return(p1*(1-mu) + (p2*mu));
}
 
My understanding of this would be that, p1 should be meeting p2''s value at a rate of mu, am I correct? If so, then is my method above right?

Share this post


Link to post
Share on other sites
Maybe the form
p(mu) = p1 + (p2-p1)*mu
makes more sense to you. You start from p1 and go towards p2. At mu=1 (mu is the parameter ho far you went) you have reached p2. At 0
Note that p(mu) goes from p1 to p2; p1 and p2 remain static.

Share this post


Link to post
Share on other sites
p1 and p2 are the endpoints. Neither changes. The interpolated value is always somewhere between p1 and p2. When mu is 0, the interpolated value is p1. When mu is 1, the interpolated value is p2. But, the endpoints do not change.

Athiest has written the more intuitive form. Your point, your interpolated value, is p(mu), a function of the parameter mu. It then, is equal to the linear interpolation between p1 and p2.

Your function is correct, and is equivalent to Athiest''s:

p(mu) = p1*(1-mu) + (p2*mu);

is the same as:

p(mu) = p1 + (p2-p1)*mu

which you can verify by doing some simple algebra.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
I asked somebody from a mathwebsite how a TI83 does square root, and one of the things mentioned was to perform quadratic interpolation between some values...what does this mean exactly? I understand what linear interpolation is, but I don''t know how you would do quadratic interpolation.

Share this post


Link to post
Share on other sites
I think for a n-order interpolation you need n+1 points given.
So for linear (n=1), you interpolate based on 2 points.
For quadratic (n=2), you should have 3 points to interpolate between them. In this case you get a point on the parabola, which these 3 points define.
For cubic ... and so on

I hope it''s clear.

Share this post


Link to post
Share on other sites