Pwelch only returns a single value?

2 views (last 30 days)
Shayma Al Ali
Shayma Al Ali on 25 Feb 2022
Commented: Mathieu NOE on 8 Mar 2022
I am trying to use the pwelch method in order to calculate the coherence magnitude squared between two signals with confidence intervals. However, the pwelch function only returns a single value. What am I doing wrong?
I also attached the variables I use in my code.
My code:
%calculate pwelch
%calculate CMS
%calculate CMS of conf intervals
  1 Comment
Mathieu NOE
Mathieu NOE on 8 Mar 2022
have you tried mscohere ?
help mscohere
mscohere Magnitude Squared Coherence Estimate.
Cxy = mscohere(X,Y) estimates the magnitude squared coherence estimate
of the system with input X and output Y using Welch's averaged,
modified periodogram method. Coherence is a function of frequency with
values between 0 and 1 that indicate how well the input X corresponds
to the output Y at each frequency. The magnitude squared coherence,
Cxy, is given by Cxy = (abs(Pxy).^2)./(Pxx.*Pyy) where Pxx and Pyy are
the power spectral density (PSD) estimate of X and Y, respectively; and
Pxy is the Cross-PSD (CPSD) estimate of X and Y. See "help pwelch" and
"help cpsd" for complete details.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by