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

Re: Reverse interpolation?



Craig Markwardt wrote:
> 
> Martin Schultz <martin.schultz@dkrz.de> writes:
> 
> Craig wrote:
> [...]
> >
> ...
> >             newxx = Spline( oldy, oldx, newy, 5. )
> ...
> 
> If you are trying to match a lot of values, then I agree that the
> spline interpolation is one of the best solutions.  However, I have
> had bad experiences with the SPLINE function.  It tends to have
> problems when the points are too far apart, and it's also pretty slow.
> I found the Numerical Recipes version of spline interpolation to be
> much better (built in functions SPL_INTERP and SPL_INIT).
> 
> If v1 is vector of values sampled at original altitudes a1, and you
> want to resample at new altitudes a2, then you do something like this:
> 
> v2 = spl_interp(a1, v1, spl_init(a1, v1), a2)
> 
> Now v2 has the newly sampled values.  In principle a2 can be one value
> so even if you want a single value the spline interpolation can be
> useful, and even pretty fast.
> 

I had looked into SPL_INTERP and SPL_INIT, but I found the
problem was that it does not allow for "smoothing" (more
correctly: controlling "the amount of tension that is applied to
the curve"). I certainly like the idea of controllin the
endpoints (which you can do only in SPL_INTERP). Are you aware of
a solution that can do both?


Martin

-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie   
[[
[[                      Bundesstr. 55, 20146 Hamburg            
[[
[[                      phone: +49 40 41173-308                 
[[
[[                      fax:   +49 40 41173-298                 
[[
[[ martin.schultz@dkrz.de                                       
[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[