I am trying to implement what's called the "second spectrum". Basically, you do this:

  1. Take a time series of length $N$.
  2. Divide it into $m$ segment, each of length $N'=N/m$.
  3. For each segment $m$, do a Fourier Transform. The result is the 'first spectrum',$S_i^{(1)}(f_1), i=1:m$
  4. Divide each spectrum into $n$ octaves, an octave starts at $f_L=f_0 \times 2^p$ and ends at $f_H=f_0 \times 2^{p+1}$, where $p=0,1,2, etc$, and $f_0$ is the lowest frequency in $S_i^{(1)}(f_1)$. For $f_0 = 1$ Hz, The octaves will be like: 1-2 Hz, 2-4 Hz, 4-8 Hz, 8-16 Hz, etc.
  5. For each octave in each spectrum, sum all spectrum values in that octave.
  6. Construct a time-series for each octave. There will be $n$ time series each of length $m$.
  7. Take the Fourier Transform of these time series. This is the second spectrum, $S_n^{(2)}(f_2)$

I have already implemented this algorithm (in c++), but I have a question:

Q: in step 4, can I simply divide the spectrum signal into octaves "just like that"? I mean, without any kind of band-pass filtering to these octaves?

EDIT: what I mean by the "just like that" is as if I am passing the spectrum through a rectangular window (in freq. domain).


I haven't heard of the second spectrum before, but yes, you can slice out a region in the frequency domain just like that. This is equivalent to a maximal-length bandpass filter in the time domain and is in fact the best filter you can implement for a given FFT length.

  • $\begingroup$ This does not seem to be right, are you sure? $\endgroup$
    – student1
    Aug 21 '14 at 22:46
  • $\begingroup$ Why don't you think it's right? Transforming to the frequency domain and taking just the bins you want is indeed an acceptable way to implement a filter. If you inverse transform the window you're implicitly applying (all zeros except at the frequency bins of interest), you'll end up with a sinc response for your filter in the time domain. $\endgroup$
    – gct
    Aug 22 '14 at 2:39
  • $\begingroup$ Isn't this like applying a rectangular window in freq. domain? Then this corresponds to infinite time-domain sinc signal... $\endgroup$
    – student1
    Aug 25 '14 at 17:21
  • $\begingroup$ You're definitely applying a rectangular window, but remember your spectrum doesn't have infinite resolution (it's sampled in frequency). So it ends up being a sinc windowed to the length of the FFT in the time domain. A longer filter response would make the transition bands smaller but you're already < 1 bin wide (thus the sharp response in frequency), so you won't be able to see anything shorter anyways. Another way to think of it is if you filtered first with that impulse response, and took the FFT, you'd see the same thing as just FFTing first and then taking the bandwidth of interest. $\endgroup$
    – gct
    Aug 25 '14 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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