What is difference between using the fft() or pspectrum() command in Matlab on a time-series signal?
My understanding is that the fft command computes the DFT of the input signal, whereas the pspectrum computes the power of spectrum of the input signal. However, I lack the intuition of the difference. When I apply both algorithm on the same signal, I observe a much more smoothened output signal with pspectrum. I was wondering if any estimation or averaging occurs when applying the pspectrum command. Is there some good reference (maybe with equation) that describes the difference and their application?
Thank you in advance!
I understand where the confusion is coming from. In the Venn diagram of the two frequencies, there is some overlap between the possible outputs of fft() and pspectrum(), particularly when getting into the input options of both.
Your biggest question seems to be the difference between a DFT and the power spectrum of the signal. Simply put, the power spectrum of a signal is processed beyond the results of running a DFT on your time-domain signal. I recommend this stack exchange thread for further information on the differences between power spectra and frequency spectra.
While this is not the only difference between the two functions, it should provide you a good starting point to help your further explorations into DSP. I would also suggest reading up on window functions and FFT (perhaps this manual may help)to further develop your understanding of these functions.
EDIT: I would be remiss not to mention the excellent overview on FFTs from another user on this forum, Neil Robertson: His writeup on dsprelated
I believe the pspectrum (power spectrum) is probably doing the following:
pspectrum[ n ] = ( 2 / # of FFT points ) * sqrt( ( fft.real[ n ] * fft_real[ n ] ) + ( fft.imag[ n ] * fft.imag[ n ] ) )
The FFT result itself is complex, whereas the power spectrum is real, and scaled.
I think pspectrum is similar to another Matlab function called pwelch. Like pspectrum, pwelch computes the power spectral density. I wrote a tutorial on using pwelch, see:
I also wrote a tutorial on the power spectrum, see: