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
phase estimation using goertzel
Started by ●October 3, 2003
Reply by ●October 3, 20032003-10-03
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.
Reply by ●October 11, 20032003-10-11
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