[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Table lookup & interpolation

From: Miquel Cabanas
Subject: Re: Table lookup & interpolation
Date: Wed, 19 Mar 2003 09:43:17 +0100
User-agent: Mutt/1.3.28i


On Wed, Mar 19, 2003 at 07:59:14AM +0000, Ted Harding wrote:
> First, for interpolation I would not use your "switch" code for
> table lookup; far too clumsy. Store the "table" as a matrix
> whose rows are corresponding values of h and p (or as two
> vectors x and p).
> For this case, log(p(h)) is quite close to a linear function of h
> (there is slight curvature). Possibly, linear interpolation of
> log(p) between points may be adequate. If not, quadratic interpolation

since your data are well posed (evenly distributed, smooth decay,
etc), you could try polyfit () to obtain a polynomial function
describing them. Check the residual to find the best polynomial.
In your case, both 2nd and 3rd order polynomials fit well your data,
and the 3rd order one has the smallest residuals (from -0.2255 to
0.26594). Hence, the 3rd order polynomial would be my choice.
Then, you can use polyval () to calculate pressures for any value
within the given range of altitudes.

Note of caution: this approach does not work for all kind of
situations, and to be correct, you should statistically test
(1) the goodness of fit and (2) the residuals distribution.


Miquel E Cabanas ------------------------------------------------------
SeRMN, Universitat Autonoma de Barcelona (address@hidden)

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]