retrieve phase information using 'pspectrum'
15 views (last 30 days)
Similar to the pwelch function, the function pspectrum divides the signal into overlapping components, windows each segment and averages the periodograms of the segments. This is very handy for signals with much noise(wich i have) and to suppress spurious components. As you can see below, left a normal fft and right using pspectrum. Pspectrum suppresses the spurious components a lot more than a normal fft.
The only problem is that: when calculating the fft you get a complex number wich you can calculate the amplitude and phase from with abs() and angle(). Using the pspectrum plot only gives you real values so you can only plot the amplitude. Is there a way so i can retrieve the complex numbers to also calculate the phase, or maybe alter the code from this psepctrum function? I really need the phase plot and because a normal fft gives bad results i need to use the pspectrum function. I also tried the pwelch function but without results. Any tips are welcome!
More Answers (1)
Thiago Henrique Gomes Lobato on 2 Aug 2020
Why you need the phase? The pspectrum function calculates the power spectrum, which depends on the absolute square of the fft, so it is not possible to get the phase back. An alternative to get a complex number would be to perform a similar algorithm averaging not the periodograms but rather the complex fft result for each block. With this, however, you probably won't have a so strong noise reduction.
Still, in your left plot the amplitudes are not in log scale, the fft resolution seems way higher, I can't exactly see a correspondence of peaks between both pictures and it is not clear what the different plots mean (different channels? Different blocks?), so, even though one may be more noisy, it is also possible that the main difference between the results is only aesthetics in relation to your goal, so before saying that one is better than other a clear definition of your goal is needed.