Re: interp2 alternative??
- From: "John D'Errico" <woodchips@xxxxxxxxxxxxxxxx>
- Date: Fri, 1 Aug 2008 18:09:03 +0000 (UTC)
"Matt " <mjacobson.removethis@xxxxxxxxxxxxx> wrote in message
<g6vh31$s54$1@xxxxxxxxxxxxxxxxxx>...
Well, yes there's a formula. Given a neighbourhood of 4
points
A B
C D
you simply
(i) Apply the 1D linear interpolation first to (A,B) and
(C,D).
(ii) Apply it a 3rd time to the result of (i)
You can expand this out into a formula if you want to.
Just to expand on what Matt said...
This trick, using three 1-d linear interpolations
is equivalent to what the image processing
types often call "bilinear" interpolation. It is
also equivalent to "tensor product linear"
interpolation. In fact, it is extensible to as
many dimensions as you have, so trilinear
interpolation can be accomplished with 7
linear interpolations, and in 4-d, quad-linear
interpolation would need 15 linear interpolations.
The other funny thing is, this method is not
truly a linear interpolation. While it has the
characteristics of a linear interpolant when
you look along either of the axes of your
data, in other directions it is clearly not
linear.
You can appreciate that by looking at the
tensor product form for the interpolant,
or if you expand the three consecutive
interpolations. This will show the bilinear
case to be equivalent to a second order
polynomial that interpolates across the 4
corners of the square. That polynomial
will have four terms in it, effectively
a1 + a2*x + a3*y + a4*x*y
Note that if we fix either x or y, then the
result is now linear in the other variable.
Another way of appreciating this not
truly linear behavior is to recognize that
three points determine a plane. So if
you actually have 4 points to interpolate
across, the result cannot be truly linear.
Finally, Matt suggested that you interpolate
first in X, then in Y. Suppose instead you
had chosen to interpolate in Y, then in X?
Would the two results be the same? (Yes,
at least they will be mathematically the
same, although in floating point arithmetic
this is not always true.)
John
.
- Follow-Ups:
- Re: interp2 alternative??
- From: Rajesh Acharya
- Re: interp2 alternative??
- References:
- interp2 alternative??
- From: Rajesh Acharya
- Re: interp2 alternative??
- From: Matt
- interp2 alternative??
- Prev by Date: Re: reading input into matrix
- Next by Date: putting together "cell" and "double"
- Previous by thread: Re: interp2 alternative??
- Next by thread: Re: interp2 alternative??
- Index(es):
Relevant Pages
|