Re: interp2 alternative??



"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
.



Relevant Pages

  • Re: bilinear interpolation
    ... that you can achieve trilinear interpolation. ... This is the bilinear interpolant. ... cost of 7 linear interpolations. ...
    (comp.soft-sys.matlab)
  • 1D cubic B-spline interpolation
    ... implement one-dimensional cubic B-spline interpolation. ... Bézier interpolation using the two original samples before where your ... Bézier interpolation you perform a series of linear interpolations as ...
    (comp.dsp)
  • Re: Pattern matching against a "use constant" character
    ... guidelines that are posted frequently? ... Unfortunately perl does not spot that this interpolation can be done ... The fact that the FAQ uses the word 'expand' rather than the more ...
    (comp.lang.perl.misc)
  • Re: Integer-Valued Polynomials
    ... variables and for general fields? ... has little to do with the question of interpolation. ... Interpolating polynomials in many variables, ... A tensor product of nonsingular ...
    (sci.math)
  • Re: ? save interpn results for later calls
    ... Let me expand on my last comment. ... We wish to use linear interpolation, ... Note that no explicit function is ...
    (comp.soft-sys.matlab)