0
$\begingroup$

I have a signal and from that I want to extract a specific frequency range, e.g. 10Hz to 15Hz. Now I heard that I should use Fast Fourier Transformation.

I'm going to do that in Matlab, but I have no idea where to start. Is there any good example how I can do this by passing the original signal and the frequency band as parameter?

$\endgroup$
3
  • 1
    $\begingroup$ Do you want to build a bandpass filter that attenuates everything but the specified frequency range or do you intend to just analyze a certain band? $\endgroup$
    – Deve
    Aug 22, 2013 at 17:15
  • $\begingroup$ I want to analyze a certain band. $\endgroup$ Aug 22, 2013 at 17:16
  • $\begingroup$ dsp.stackexchange.com/questions/9251/… $\endgroup$
    – niaren
    Aug 22, 2013 at 20:12

1 Answer 1

1
$\begingroup$

To analyze a certain frequency band, you first have to know the sampling frequency $f_\mathrm{S}$ that has been used to acquire your signal $x$. To compute the discrete Fourier transform (DFT) in Matlab:

y = fft(x);

The output of Matlab's FFT function has length $N$ and begins with frequency 0, $N$ beeing the length of $x$. The frequency range you're looking for therefore lies in the index range $$ N\frac{f_1}{f_\mathrm{S}} + 1\ldots N\frac{f_2}{f_\mathrm{S}} +1 $$ Where $f_1$ is the lower and $f_2$ is the upper limit of your frequency range and $f_1 \leq f_2 \leq f_\mathrm{S}/2$ must hold. The addition of 1 accounts for Matlab indices beginning at 1, not at 0. Also note that in general the above expressions are non-integer numbers.

$\endgroup$
4
  • $\begingroup$ Ok I see, but somehow I want the range I'm looking for for every data point. If I understood you correctly y has then only 1 datapoint in each bin for my signal. $\endgroup$ Aug 22, 2013 at 17:39
  • $\begingroup$ I assumed your signal was a time series, isn't it? $\endgroup$
    – Deve
    Aug 22, 2013 at 17:42
  • $\begingroup$ Hmm let me make an example. I have sample my signal at 500Hz. So if I pass a 1 second sample of this signal as x to the fft function, then I get back only one value for my frequency range, but I want to have also 500. $\endgroup$ Aug 22, 2013 at 17:45
  • $\begingroup$ That's impossible. Additionaly, the frequency range from 10 to 15 Hz corresponds to 6 samples in the FFT output in your example. $\endgroup$
    – Deve
    Aug 22, 2013 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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