DSPRelated.com
Forums

phase estimation using goertzel

Started by Thijs October 3, 2003
Hi,

I'd like to detect a few frequencies from a signal. 
right now i have:

t=[1:length]'./length;
sinus   = sin(2*pi*freq*t);    
cosinus = cos(2*pi*freq*t);
a = sinus'*block;
b = cosinus'*block;
angle=atan2(b,a);
amplitude = sqrt(a^2+b^2);

this works, but is quite slow. I do have some code for a goertzel
algorithm, the amplitude seems to be correct, but the phase is totally
wrong.

Does somebody know where i can get the formula for the correct
calculation of the phase using goertzel ?

Greetz,

Thijs
Thijs wrote:
> Hi, > > I'd like to detect a few frequencies from a signal. > right now i have: > > t=[1:length]'./length; > sinus = sin(2*pi*freq*t); > cosinus = cos(2*pi*freq*t); > a = sinus'*block; > b = cosinus'*block; > angle=atan2(b,a); > amplitude = sqrt(a^2+b^2); > > this works, but is quite slow. I do have some code for a goertzel > algorithm, the amplitude seems to be correct, but the phase is totally > wrong. > > Does somebody know where i can get the formula for the correct > calculation of the phase using goertzel ?
It would have been better to post the non-working code since that's what your question is really about. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (703) 779-7770 Visualize whirled peas.
On Fri, 03 Oct 2003 11:56:34 GMT, t.t.withaar@student.etc.etc (Thijs)
wrote:

>angle=atan2(b,a);
I run into similar problem and discover that in my case the result phase was shifted 90 deg: angle=Pi/2 + atan2(b,a); I'm not very familiar with spectral analysis and Goertzel and my solution could be wrong but it work for me. Andy