Someone smart please help me with interpolation!!
From: SS (google_at_alienworks.com)
Date: 10/26/04
- Next message: Fabio Garufi: "fftw-3.0.1-fma + Lynxos+PPC G4 fails tests."
- Previous message: Peter Lindroth: "Re: AMPL - matlab"
- Next in thread: Fred Krogh: "Re: Someone smart please help me with interpolation!!"
- Reply: Fred Krogh: "Re: Someone smart please help me with interpolation!!"
- Reply: Sue Taylor: "Re: Someone smart please help me with interpolation!!"
- Reply: bv: "Re: Someone smart please help me with interpolation!!"
- Messages sorted by: [ date ] [ thread ]
Date: 26 Oct 2004 07:00:05 -0700
I need someone to help me with a problem that I'm sure will be a piece
of cake for all you smart math people... :)
I have an audio waveform that is sampled at regular intervals. I need
to determine the zero crossing point of this waveform as accurately as
possible. Doing a simple search through the data, I can find the
point where the samples go from negative to positive. Right now to
determine the actual zero crossing point, I do a simple linear
interpolation. I am getting good results, but the linear
interpolation is definitely the part of my algorithm that introduces
the most error.
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.
Basically I have this:
(x0, y0), (x1, y1), (x2, y2), (x3, y3)
The four data points are chosen so that y1 is always negative and y2
is always positive. As it turns out, in my data at least, y0 will
always be less than y1 and y3 will always be more than y2. So
basically y0 < y1 < y2 < y3. And y1 < 0 and y2 > 0. x0, x1, x2, x3
are all evenly spaced at, say, 0, 1, 2, 3. The crossing point will
therefore be somewhere between y1 and y2, and I need to find the x
value where this happens. So the result from the algorithm should
give me a value of x >= 1 and x <= 2. For my linear interpolation
function right now I only use (x1, y1) and (x2, y2). In theory I can
use a larger set of samples before or after the crossing point, so if
there is a good algorithm that uses more than the 4 points that could
work too.
Can one of you generous, smart people please give me a simple formula
that (let's say) your average Joe can apply in an actual C program?
Thanks in advance!!
SS
- Next message: Fabio Garufi: "fftw-3.0.1-fma + Lynxos+PPC G4 fails tests."
- Previous message: Peter Lindroth: "Re: AMPL - matlab"
- Next in thread: Fred Krogh: "Re: Someone smart please help me with interpolation!!"
- Reply: Fred Krogh: "Re: Someone smart please help me with interpolation!!"
- Reply: Sue Taylor: "Re: Someone smart please help me with interpolation!!"
- Reply: bv: "Re: Someone smart please help me with interpolation!!"
- Messages sorted by: [ date ] [ thread ]