MATLAB Answers

retrieve phase information using 'pspectrum'

3 ビュー (過去 30 日間)
Sören Gevaert
Sören Gevaert 2020 年 8 月 2 日
回答済み: Star Strider 2020 年 8 月 2 日
Hi
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!
kind regards

  0 件のコメント

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2020 年 8 月 2 日
If you use the bandpass filter approach in digital signal related question(fft,pspectrum) you can easily recover the phase information from the fft of the output.

  0 件のコメント

サインインしてコメントする。

その他の回答 (1 件)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020 年 8 月 2 日
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.

  1 件のコメント

Sören Gevaert
Sören Gevaert 2020 年 8 月 2 日
Thank you for the answer Thiago
I need the phase corresponding to the amplitude of the frequency components of interest. After obtaining both phase and amplitude i need to put this information in a mathematical formula to calculate an exposure index from a device. In this case the components are 200Hz and 400Hz. Why these components? because of the information obtained from a spectrogram(also calculated with pspectrum).
This is a meassurement from a device that was turned on after a couple of seconds. You can see a component on 200Hz and a small one on 400Hz. Then i extract the signal from 5 to 14seconds and perform a fft because i need phase and amplitude information. Clearly you can see spurious components coming up wich is not wanted. Thats why i wanted to know if there was a way to maybe modify/alter the code from pspectrum so i can obtain phase information. Unfortunately as you say it is not possible.
Still, in your left plot the amplitudes are not in log scale, the fft resolution seems way higher,
Indeed, the left plot(normal fft) is not in log scale but nevertheless it shouldnt give a peak higher than that from 200Hz on other frequencys? In this case it does give one at around 150Hz wich might be a spurious component?
The resolution is indeed way higher but i dont think this is a problem for the result i want.
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?),
Looking at the spectrogram above the components 200Hz and 400Hz appear at around 5seconds. So i extract this time information(from5 to 14seconds) and perform a normal fft(figure on the left) and also use pspectrum(figure on the right). Each colour represents a different channel because the signal exists of 3 components(x,y and z) but it is ok to just look at the blue spectrum(component x). As you can see the pspectrum supresses the noise much better than that of a normal fft or am i wrong?
conclusion: I only need the amplitude and phase of 200Hz and 400Hz so the best way to do this, is to perform a similar algoritm as pwelch/pspectrum but averaging each complex number from each block? Or maybe just use a bandpass filter for the components 200Hz and 400Hz as i only need the phase and amplitude of these 2?
Thanks in advance

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by