Sign in to follow this  

How can I Interpolating 3 variables?

This topic is 3372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Just one question. I would like to know, or to aproximate the value of a variable which depends of 2 variables. I know how to do this using just one variable and a spline or something like that. But how to do that with 3 variables? Probably is similar but I would like to hear your suggestions. And Is it a spline the proper way? Thanks a lot. Ricardo.

Share this post


Link to post
Share on other sites
This problem is exactly what image interpolation is. Say you have a monochrome image. This is really just a function from the (x,y) coordinates in the image to a brightness value. So if you look up image interpolation, most of the algorithms you'll find will be directly applicable to your problem. This also gives a nice way to visualize your problem.

Anyway, there are lots of techniques, including various spline methods. But I'd probably just recommend looking at,
1 - Bilinear interpolation
2 - Bicubic interpolation

Of these, #1 is the easiest, but #2 is usually "nicer." Both are very commonly-used.

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
Or perhaps the OP means a linear interpolation f=lerp(a,b,t) between 2 values a and b using the blending factor t, as opposed to a spline function f=spline(t) in t?


You mean like,

lerp(a, b, t) = (1 - t/T)*a + (t/T)*b

where t is in the interval [0, T]? The direct 2-d analogue of this is bilinear interpolation, n'est-ce pas? I.e.,

lerp(a,b,c,d,s,t) = (1 - s/S)[(1 - t/T)a + (t/T)b] + (s/S)[(1 - t/T)c + (t/T)d]

Share this post


Link to post
Share on other sites
Quote:
Original post by Emergent
You mean like,
lerp(a, b, t) = (1 - t/T)*a + (t/T)*b
where t is in the interval [0, T]?

This is 1D (unnormalized) lerp, exactly.

Quote:
Original post by Emergent
The direct 2-d analogue of this is bilinear interpolation, n'est-ce pas? I.e.,
lerp(a,b,c,d,s,t) = (1 - s/S)[(1 - t/T)a + (t/T)b] + (s/S)[(1 - t/T)c + (t/T)d]

The question is (as was asked in the now deleted post between ours above) what exactly the OP is asking for. Interpolating between 2 variables happens normally in 1D, since 2 values is the minimum for interpolation and resticts usage to 1D. Bilinear lerp works in 2D and interpolates 4 values thoroughly. The OP explicitely speaks of 3 values, what can also mean quadratic interpolation in 1D. Or s/he named the blend factor the "3rd variable" and hence actually meant lerp in 1D. Or ... whatever. Hence my indirect request for more information.

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
The question is (as was asked in the now deleted post between ours above) what exactly the OP is asking for. Interpolating between 2 variables happens normally in 1D, since 2 values is the minimum for interpolation and resticts usage to 1D. Bilinear lerp works in 2D and interpolates 4 values thoroughly. The OP explicitely speaks of 3 values, what can also mean quadratic interpolation in 1D. Or s/he named the blend factor the "3rd variable" and hence actually meant lerp in 1D. Or ... whatever. Hence my indirect request for more information.


Oh! I see.

So, what you are calling variables, I would normally call "values" to avoid confusion, since colloquially the line between "variable" and "function" is somewhat blurry (e.g., when we speak of "independent and dependent variables," the dependent "variable" is a function of the independent variable.)

(This is an intellectual "messiness" which I think is responsible for much confusion in elementary schools everywhere.)

Also, I noticed as well that there definitely is some inconsistency in the OP's post. He speaks of two variables, and then of three. I assumed that this meant that there were two independent variables, and one dependent variable. So really, to be clear, I was assuming that he wants to interpolate between samples of a scalar-valued function of two arguments.

Share this post


Link to post
Share on other sites
Quote:
Original post by riruilo
But how to do that with 3 variables? Probably is similar but I would like to hear your suggestions. And Is it a spline the proper way?


An example of B-spline volume interpolation is Mathematics, scroll to the end of the page and look at Wm4BSplineVolume.* files.

Share this post


Link to post
Share on other sites

This topic is 3372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this