Tuesday, September 17, 2019

fourier transform - FFT for a single frequency


I was looking for a more efficient way of finding the magnitude and phase of a signal at a certain frequency without performing an FFT because it produces more information than I need and I came across this comment on the Matlab message board:


http://www.mathworks.com/matlabcentral/newsreader/view_original/250421.


If I am sampling at 1500Hz and my signal is 100 points and I am looking for the phase and magnitude at 15Hz, would this be suitable method for obtaining the information I need? Also, why does the OP suggest windowing the signal as well?



Answer



It's certainly calculating the right thing. Though instead of


sum(x.*(cos(1000*2*pi*t)-i*sin(2*pi*1000*t)))*2/N;

you might try



sum(x.*exp(-i*2*pi*1000*t))*2/N;

If you need to do something similar, but in-line (not in a batch), you might want to look at the Goertzel algorithm. As the Wikipedia link says:



.. provides a means for efficient evaluation of individual terms of the Discrete Fourier Transform



And there's nothing particularly "Fast" about this way of doing it, so it's really just calculating one DFT bin.


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...