How to use pwelch for PSD?

133 vues (au cours des 30 derniers jours)
Tran
Tran le 12 Déc 2022
hi everyone, Do you know about pwelch function? I did a lot of searching on google but didn't find any documentation that explains correctly for me to understand. When I want to use the pwelch function, do I have to care about the window or can I leave it at the default. For an example:
If I want to use window for eeg signal, what kind of window can i use for best perform? and what are the parameters passed in?
Hope I don't bother you,
[pb,f] = pwelch(Data(1,:),hamming(256),[],[1 256],128);
[pb,f] = pwelch(Data(1,:),[],[],[],128);
  2 commentaires
Bora Eryilmaz
Bora Eryilmaz le 12 Déc 2022
Modifié(e) : Bora Eryilmaz le 12 Déc 2022
I recommend using pspectrum instead, which is more straighforward to use. It internally uses the Kaiser window, which is controlled by the "Leakage" parameter of the pspectrum command. Kaiser window is pretty optimal when it comes to selecting a window for spectrum computation.

Connectez-vous pour commenter.

Réponse acceptée

William Rose
William Rose le 12 Déc 2022
See my recent reply to @vo, here, regarding the use of Welch's method for EEG analysis. You can get identical results using pwelch() or cpsd(). @vo wanted to use cpsd(). You can use pwelch(). Either one is fine.
See my followup comment at the site above for an explanation of the arguments to pwelch() or cpsd(). The default values are a reasonable place to start. A important fundamental concept is that spectrum estimation involves a tradeoff between high frequency resolution and high certainty (i.e. small random errors) in the estimate. The choice of window length is the main determinant of where one sits with regard to this tradeoff. A large value for window length favors high spectral resolution. A small value favors smaller random errors.
"window" can be a vector or an integer. If "window" is a vector, then it is the actual window coefficients, and the window length is the length of this vector. If "window" is an integer, then a Hamming window of the specified length is used. I recommend that you specifiy "window" as an integer, because a Hamming window is fine. You can make "window" be 1/4 or less of the total signal duration.
I recommend that noverlap be 1/2 or 2/3 or 3/4 of window.
I recommend that nfft be equal to window.
The image below, from some lecture notes, illustrates how Welch's method works, with half-overlapped segments. In this example, the original signal has length N=256, window=N/4, noverlap=N/8, nfft=N/4.

Plus de réponses (0)

Catégories

En savoir plus sur Parametric Spectral Estimation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by