Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

EDIT:

First off let me explain that I understand that frequency makes no sense for a single sample. What I am actually talking about is the power spectrum within a short time window around a specific sample.

I have a time varying discrete signal: $\ s(t_i), i=0...199 $ with sampling dt = 10 ms.

I want to find the power of a specific frequency: 15 Hz at time sample j = 100.

This is how I would solve this:

I understand that I must extract a subset of the signal in a window around j = 100 and multiply it with a window function to avoid "ringing".

I therefore extract the subset j=93..107 and multiply it with a -/+ 2 standard deviations gaussian kernel.

Any advice on the size of the window?

Next I zero-pad the subset to 512 samples in order to achieve some "spectral interpolation" and take the FFT.

Finally I locate the complex number corresponding to f=15 Hz and take the absolute value.

Actually I would repeat this procedure for j = 7...192 to find the power of f=15 Hz at each sample.

However reading about the Short Time Fourier Transform got me confused:

they seem to break the data to be transformed into overlapping chunks, window the data within each chunk, take the FFT and then somehow adding the results together!?

Is this just a matter of performance? As a first solution I would prefer a simple but slow approach (such as mine).

share|improve this question
2  
I think that the term "frequency" has no sense for a single time sample as the term "duration" has no meaning for single frequency sample. But you might be interested in the concept of "instant frequency" which still applies to a sample series, not single sample. –  mbaitoff Jan 31 '13 at 14:18
    
Maybe this is just a bit sloppy languange on my part and what I should ask is: How do I find the power of a specific frequency within a window centered around a specific sample of a discrete time varying signal? This is a bit long for a question title though. –  Andy Jan 31 '13 at 14:28
5  
@Andy: What you're doing is the short-time Fourier transform. Any time you take a small window ("a short amount of time") from a larger signal and then calculate its Fourier transform, you're using the STFT. There are some cases where you might overlap consecutive windows, but that's not a requirement. Also, you don't necessarily need to add or average the results together; it depends on what you want. If you sum multiple transforms together, you're sacrificing time resolution in order to perhaps smooth out some noise in the spectrum. –  Jason R Jan 31 '13 at 15:01
    
@Jason R: thanks! That is reassuring. Then I'll just keep doing this :-). –  Andy Jan 31 '13 at 15:06
add comment

1 Answer 1

up vote 1 down vote accepted

I realize this doesn't answer the detail of what you're asking, but I believe it answers the question in the title:

See Rick Lyons's writeup here for using the Goertzel algorithm to get the signal level at a specific frequency.

You can then follow up the equations:

enter image description here

with:

$$ \hat{p}(n) = | y(n) |^2 $$

and use $\hat{p}(n)$ as your "instantaneous power" at frequency $\omega =2\pi m/N$ --- which is sort of like Lyons's eq. 13.83:

enter image description here

(though he's evaluating this one at the "end" of his DFT length).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.