Welch PSD Object to Function Replacement Syntax

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

Deprecated Syntax

Replacement Syntax

h = spectrum.welch;
psd(h,x);
pwelch(x);
h = spectrum.welch('Gaussian');
psd(h,x);
win = gausswin(64);
pwelch(x,win);
Welch estimate with window function and optional input arguments:
h = spectrum.welch({'Hamming','periodic'});
psd(h,x);
win = hamming(64,'periodic');
pwelch(x,win);
Taylor window and multiple optional input arguments:
nbar = 4;
sll = 30;
h = spectrum.welch({'Taylor', nbar, sll});
psd(h,x);
nbar = 4;
sll = -30;
win = taylorwin(64,nbar,sll);
pwelch(x,win);
h = spectrum.welch('Hamming',segLen);
psd(h,x);
win = hamming(segLen);
pwelch(x,win);
h = spectrum.welch({'Hamming','periodic'},...
segLen);
psd(h,x);
win = hamming(segLen,'periodic');
pwelch(x,win);
nbar = 4;
sll = 30;
h = spectrum.welch({'Taylor',nbar,sll},...
segLen);
psd(h,x);
nbar = 4;
sll = -30;
win = taylorwin(segLen,nbar,sll);
pwelch(x,win);
h = spectrum.welch('Hamming',segLen,ovlpPct);
psd(h,x);
win = hamming(segLen);
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap);
h = spectrum.welch({'Hamming','periodic'},...
segLen,ovlpPct);
psd(h,x);
win = hamming(segLen,'periodic');
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap);
nbar = 4;
sll = 30;
h = spectrum.welch({'Taylor',nbar,sll},...
segLen,ovlpPct);
psd(h,x);
nbar = 4;
sll = -30;
win = taylorwin(segLen,nbar,sll);
Noverlap = ceil((ovlpPct/100)*segLen);
pwelch(x,win,Noverlap);
h = spectrum.welch(...);
psd(h,x,'NFFT',nfft);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,nfft);
h = spectrum.welch(...);
psd(h,x,'Fs',fs);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,[],fs);
h = spectrum.welch(...);
psd(h,x,'NFFT',nfft,'Fs',fs);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,nfft,fs);
h = spectrum.welch(...);
psd(h,x,...,'FreqPoints','User Defined',...
'FrequencyVector',w);
win = ...
periodogram(x,win,w);
h = spectrum.periodogram(...);
psd(h,x,'FreqPoints','User Defined',...
'FrequencyVector',f,'Fs',fs);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,f,fs);
Two-sided spectrum of a real signal:
h = spectrum.welch(...);
psd(h,x,...,'SpectrumType','TwoSided');
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...,'twosided');
Two-sided spectrum with DC (0 frequency) in the center:
h = spectrum.welch(...);
psd(h,x,...,'CenterDC',true);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...,'centered'); 
h = spectrum.welch(...);
psd(h,x,...,'ConfLevel',p);
win = ...
Noverlap = ...
pwelch(x,win,Noverlap,...'ConfidenceLevel',p);
h = spectrum.welch(...);
hPSD = psd(h,x,...);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
win = ... 
Noverlap = ...
[Pxx,F] = pwelch(x,win,Noverlap,...); 
h = spectrum.periodogram(...);
hPSD = psd(h,x,...,'ConfLevel',p);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
Pxxc = hPSD.ConfInterval;
win = ... 
Noverlap = ...
[Pxx,F,Pxxc] = pwelch(x,win,Noverlap,...
'ConfidenceLevel',p); 

Was this topic helpful?