Re: Someone smart please help me with interpolation!!

From: bv (bvoh_at_Xsdynamix.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 18:59:42 GMT

SS wrote:
>
> Can someone please give me some ideas of how to do an interpolation of
> the data that will result in higher accuracy? I have searched all
> over the internet but my problem is that I have a hard time applying
> the theories to actual C/C++ source code. It's been a long time since
> I had to delve deeply into math theory. I have looked at various
> methods, including cubic spline, but I just can't seem to find some
> example that does what I do. And they all seem to return the value of
> x and y at a certain point along the curve, while I need the value of
> x when y is zero, so I have a hard time figuring out how to do this.

Fitting a cubic spline in the neighborhood spanning the zero crossing
should do nicely, and then find the zero via Newton-Raphson algorithm.

        - spline fit http://netlib.org/sfmm/spline.f
        - find zero x = x - p(x)/p'(x)

btw, "spline" code (Fortran) is small and straightforward and should be
an easy translation to C.