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.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
2  
I believe it is $| \mathcal{F} log(|S(f)|^{2})|^{2}$ –  Mohammad Oct 30 '12 at 21:51
    
If $S(f)$ is a spectrum and not just an FFT then it has already been squared. –  ncRubert Oct 31 '12 at 0:04
    
Yeah, but $S(f)$ is usually taken to just mean the DFT, so it may get confusing if someone arbitrarily changes the meaning. –  Mohammad Oct 31 '12 at 11:38
    
Yes, I only have the real part. –  SooDesuNe Oct 31 '12 at 12:16
    
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. –  SooDesuNe Oct 31 '12 at 12:31
show 6 more comments

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.