I am not a DSP expert, so I would like someone to check my thought process:

I have a text file representing the spectrum (calculated by some FFT hardware), and I'd like to calculate a cepstrum. I'm using Octave in the examples below, but it's not required.

  • My source data is two columns: frequency, amplitude, i.e.:
| 0.00E+00 | 6.93E+01 |
| 1.00E+01 | 6.95E+01 |
| 2.00E+01 | 7.38E+01 |
| ...      | ...      |
| 2.00E+03 | 6.51E+01 |
  • Load the data in to Octave, and use ifft to put the spectrum into the time domain. Then use rceps to calculate the cepstrum:

    rceps(ifft(my_data(:,2))); % my_data is the 2000x2 matrix from above

  • Plot the result of rceps. The resulting curve should equal cepstrum that would have been produced if I had started with a time domain signal.

Is this a correct way to find the cepstrum when only spectrum (FFT) is available, or, is there a flaw in my thought process?


The cepstrum is defined as:

$C = | \mathcal{F} \log( P(f) ) |^2$

$\mathcal{F}$ is a Fourier transform and $P(f)$ is the power spectrum. If you've got the power spectrum for the signal there is no need to go back to the time domain. Just take the logarithm, compute an FFT, take the magnitude squared of the result.

Also, the data you list is strictly positive and real so I'm assuming it's the spectrum. At the end of your question you put spectrum (FFT). If what you had was an FFT of a real-valued time domain signal, and not a spectrum, I would expect it to have an imaginary part.

| improve this answer | |
  • 2
    $\begingroup$ I believe it is $| \mathcal{F} log(|S(f)|^{2})|^{2}$ $\endgroup$ – Spacey Oct 30 '12 at 21:51
  • $\begingroup$ If $S(f)$ is a spectrum and not just an FFT then it has already been squared. $\endgroup$ – ncRubert Oct 31 '12 at 0:04
  • $\begingroup$ Yeah, but $S(f)$ is usually taken to just mean the DFT, so it may get confusing if someone arbitrarily changes the meaning. $\endgroup$ – Spacey Oct 31 '12 at 11:38
  • $\begingroup$ Yes, I only have the real part. $\endgroup$ – SooDesuNe Oct 31 '12 at 12:16
  • $\begingroup$ When you say "take the magnitude squared", that means do something like: abs(fft_result).**2? Because fft_result has complex numbers abs(number).**2 != number.**2, as it would with real numbers. $\endgroup$ – SooDesuNe Oct 31 '12 at 12:31

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.