Welch MSSPECTRUM Object to Function Replacement Syntax

The following table gives the deprecated spectrum.welch MSSPECTRUM object syntax and the equivalent recommended function syntax for pwelch. In the modified periodogram, you use a window other than the default rectangular window. To illustrate modified periodogram syntaxes, the table uses a specific window. In each example, x is the input signal.

Deprecated Syntax

Recommended Syntax

h = spectrum.welch
msspectrum(h,x);
win = hamming(64);
pwelch(x,win,[],'power');
h = spectrum.welch('Gaussian');
msspectrum(h,x);
win = gausswin(64);
pwelch(x,win,[],'power');
h = spectrum.welch({'Hamming','periodic'});
msspectrum(h,x);
win = hamming(64,'periodic');
pwelch(x,win,[],'power');
nbar = 4;
sll = 30;
h = spectrum.welch({'Taylor',nbar,sll});
msspectrum(h,x);
nbar = 4;
sll = -30;
win = taylorwin(64,nbar,sll);
pwelch(x,win,[],'power');
segLen = 128;
h = spectrum.welch('Hamming',segLen);
msspectrum(h,x);
win = hamming(128);
pwelch(x,win,[],'power');
segLen = 128;
h = spectrum.welch({'Hamming','periodic'},...
segLen);
msspectrum(h,x);
win = hamming(128,'periodic');
pwelch(x,win,[],'power');
nbar = 4;
sll = 30;
segLen = 128;
h = spectrum.welch({'Taylor',nbar,sll},segLen);
msspectrum(h,x);
nbar = 4;
sll = -30;
segLen = 128;
win = taylorwin(segLen,nbar,sll);
pwelch(x,win,[],'power');
segLen = 128;
ovlpPct = 50;
h = spectrum.welch('Hamming',segLen,ovlpPct);
msspectrum(h,x);
segLen = 128;
win = hamming(segLen);
ovlpPct = 50;
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap,'power');
segLen = 128;
ovlpPct = 50;
h = spectrum.welch({'Hamming','periodic'},...
segLen,ovlpPct);
msspectrum(h,x);
segLen = 128;
ovlpPct = 50;
win = hamming(segLen,'periodic');
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap,'power');
nbar = 4;
sll = 30;
segLen = 128;
ovlpPct = 50;
h = spectrum.welch({'Taylor',nbar,sll},...
segLen,ovlpPct);
msspectrum(h,x);
nbar = 4;
sll = -30;
segLen = 128;
win = taylorwin(segLen,nbar,sll);
ovlpPct = 50;
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap,'power');
h = spectrum.welch(...);
msspectrum(h,x,'NFFT',nfft);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,nfft,'power');
h = spectrum.welch(...);
msspectrum(h,x,'Fs',fs);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,[],fs,'power');
h = spectrum.welch(...);
msspectrum(h,x,'NFFT',nfft,'Fs',fs);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,nfft,fs,'power');
h = spectrum.welch(...);
msspectrum(h, x,...,'FreqPoints','User Defined',...
 'FrequencyVector',w);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,f,fs,'power');
h = spectrum.welch(...);
msspectrum(h,x,...,'SpectrumType','TwoSided');
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...,'twosided','power');
h = spectrum.welch(...);
msspectrum(h,x,...,'CenterDC',true);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...,'centered','power'); 
h = spectrum.welch(...);
msspectrum(h,x,...,'ConfLevel',p);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...,'ConfidenceLevel',p,'power'); 
h = spectrum.welch(...);
hMS = msspectrum(h,x,...);
Sxx = hMS.Data;
F = hMS.Frequencies;
[Sxx,F] = pwelch(...,'power'); 
h = spectrum.welch(...);
hMS = msspectrum(h, x, …, ‘ConfLevel', p);
Sxx = hMS.Data;
F = hMS.Frequencies;
Sxxc = hMS.ConfInterval;
[Sxx,F,Sxxc] = pwelch(...,'ConfidenceLevel',p,'power'); 

Was this topic helpful?