Main Content

Nonparametric Spectrum Object to Function Replacement

Periodogram PSD Object to Function Replacement Syntax

The spectrum.periodogram object syntax will be removed in the future. The following table gives the equivalent recommended function syntax for periodogram. 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

Replacement Syntax

h = spectrum.periodogram;
psd(h,x);
periodogram(x);
% Modified periodogram with window function
h = spectrum.periodogram('hamming');
psd(h,x);
win = hamming(length(x));
periodogram(x,win);
% Window function and optional input arguments to window function
h = spectrum.periodogram({'Hamming','periodic'});
psd(h,x);
win = hamming(length(x),'periodic');
periodogram(x,win);
% Taylor window and multiple optional input arguments
nbar = 4;
sll = 30;
h = spectrum.periodogram({'Taylor',nbar,sll});
psd(h,x,'Fs',fs,'centerdc',true);
nbar = 4;
sll = -30;
win = taylorwin(length(x),nbar,sll);
periodogram(x,win,[],fs,'centered');
h = spectrum.periodogram(...);
psd(h,x,'NFFT',nfft);
win = ...
periodogram(x,win,nfft);
h = spectrum.periodogram(...);
psd(h,x,'Fs',fs);
win = ...
periodogram(x,win,[],fs);
h = spectrum.periodogram(...);
psd(h,x,'NFFT',nfft,'Fs',fs);
win = ...
periodogram(x,win,nfft,fs);
h = spectrum.periodogram(...);
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 = ...
periodogram(x,win,f,fs);
% Two-sided spectrum of a real signal
h = spectrum.periodogram(...);
psd(h,x,...,'SpectrumType','TwoSided');
win = ...
periodogram(x,win,...,'twosided');
% Two-sided spectrum with DC (0 frequency) in the center
h = spectrum.periodogram(...);
psd(h,x,...,'CenterDC',true);
win = ...
periodogram(x,win,...,'centered'); 
h = spectrum.periodogram(...);
psd(h,x,...,'ConfLevel',p);
win = ...
periodogram(x,win,...,'ConfidenceLevel',p);
h = spectrum.periodogram(...);
hPSD = psd(h,x,...);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
win = ... 
[Pxx,F] = periodogram(x,win,...); 
h = spectrum.periodogram(...);
hPSD = psd(h,x,...,'ConfLevel',p);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
Pxxc = hPSD.ConfInterval;
win = ... 
[Pxx,F,Pxxc] = periodogram(x,win,...); 

Periodogram MSSPECTRUM Object to Function Replacement Syntax

The spectrum.periodogram MSSPECTRUM object syntax will be removed in the future. The following table gives the equivalent recommended function syntax for periodogram. 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.periodogram;
msspectrum(h,x);
periodogram(x,'power');
h = spectrum.periodogram('Hamming');
msspectrum(h,x);
win = hamming(length(x));
periodogram(x,win,'power');
h = spectrum.periodogram({'Hamming','periodic'});
msspectrum(h,x);
win = hamming(length(x),'periodic');
periodogram(x,win,'power');
nbar = 4;
sll = 30;
h = spectrum.periodogram({'Taylor',nbar,sll});
msspectrum(h,x);
nbar = 4;
sll = -30;
win = taylorwin(length(x),nbar,sll);
periodogram(x,win,'power');
h = spectrum.periodogram(...);
msspectrum(h,x,'NFFT',nfft);
win= ...
periodogram(x,win,nfft,'power');
h = spectrum.periodogram(...);
msspectrum(h,x,'Fs',fs);
win = ...
periodogram(x,win,[],fs,'power');
h = spectrum.periodogram(...);
msspectrum(h,x,'NFFT',nfft,'Fs',fs);
win = ...
periodogram(x,win,nfft,fs,'power');
h = spectrum.periodogram(...);
msspectrum(h,x,...,'SpectrumType','TwoSided');
win = ...
periodogram(x,win,..., 'twosided','power');
h = spectrum.periodogram(...);
msspectrum(h, x,...,'CenterDC',true);
win = ...
periodogram(x,win,...,'centered','power'); 
h = spectrum.periodogram(...);
msspectrum(h,x,...,'ConfLevel',p);
win = ...
periodogram(x,win,...,'ConfidenceLevel', p,...'power'); 
h = spectrum.periodogram(...);
hMS = msspectrum(h,x,...);
Sxx = hMS.Data;
F = hMS.Frequencies;
win = ...
[Sxx,F] = periodogram(x,win,...,'power'); 
h = spectrum.periodogram(...);
hMS = msspectrum(h,x,...,'ConfLevel',p);
Sxx = hMS.Data;
F = hMS.Frequencies;
Sxxc = hMS.ConfInterval;
win = ...
[Sxx,F,Sxxc] = periodogram(x,win,...,'power'); 

Welch PSD Object to Function Replacement Syntax

The spectrum.welch object syntax will be removed in the future. The following table gives 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);

Welch MSSPECTRUM Object to Function Replacement Syntax

The spectrum.welch MSSPECTRUM object syntax will be removed in the future. The following table gives 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'); 

Multitaper PSD Object to Function Replacement Syntax

The spectrum.mtm object syntax will be removed in the future. The following table gives the equivalent recommended function syntax for pmtm. In each example, x is the input signal.

Deprecated Syntax

Recommended Syntax

hMTM = spectrum.mtm;
psd(hMTM,x);
pmtm(x,4);
hMTM = spectrum.mtm(NW);
psd(hMTM,x);
pmtm(x,NW);
[E,V] = dpss(length(x),NW);
hMTM = spectrum.mtm(E,V);
psd(hMTM,x);
[E,V] = dpss(length(x),NW);
pmtm(x,E,V);
hMTM = spectrum.mtm(NW);
psd(hMTM,x,'Fs',fs);
pmtm(x,NW,fs);
hMTM = spectrum.mtm(E,V);
psd(hMTM,x,'Fs',fs);
pmtm(x,E,V,fs);
hMTM = spectrum.mtm(NW);
psd(hMTM,x,'Fs',fs,'NFFT',nfft);
pmtm(x,NW,nfft,fs);
hMTM = spectrum.mtm(E,V);
psd(hMTM,x,'Fs',fs,'NFFT',nfft);
pmtm(x,E,V,nfft,fs);
hMTM = spectrum.mtm(NW);
psd(hMTM,x,'FreqPoints','User Defined',...
'FrequencyVector',w);
pmtm(x,NW,w);
hMTM = spectrum.mtm(E,V);
psd(hMTM,x,'FreqPoints','User Defined',...
'FrequencyVector',w);
pmtm(x,E,V,w);
hMTM = spectrum.mtm(NW);
psd(hMTM,x,'FreqPoints','User Defined',...
'FrequencyVector',f,'Fs',fs);
pmtm(x,E,V,f,fs);
hMTM = spectrum.mtm(E,V);
psd(hMTM,x,'FreqPoints','User Defined',...
'FrequencyVector',f,'Fs',fs);
pmtm(x,E,V,f,fs);
hMTM = spectrum.mtm(...,'Adaptive');
psd(hMTM,...);
pmtm(...,'adapt');
hMTM = spectrum.mtm(...,'Eigenvalue');
psd(hMTM,...);
pmtm(...,'eigen');
hMTM = spectrum.mtm(...,'Unity');
psd(hMTM,...);
pmtm(...,'unity');
hMTM = spectrum.mtm(...);
psd(hMTM,...,'SpectrumType','twosided');
pmtm(...,'twosided');
hMTM = spectrum.mtm(...);
psd(hMTM,...,'SpectrumType','twosided',...
'CenterDC',true);
pmtm(...,'centered');
hMTM = spectrum.mtm(...);
psd(hMTM,...,'ConfLevel',p);
pmtm(...,'ConfidenceLevel',p); 
hMTM = spectrum.mtm(...);
hPSD = psd(hMTM,...);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
[Pxx,F] = pmtm(...);
hMTM = spectrum.mtm(...);
hPSD = psd(hMTM,x,'ConfLevel',p);
Pxx = hPSD.Data;
F = hPSD.Frequencies;
Pxxc = hPSD.ConfInterval;
[Pxx,F,Pxxc] = pmtm(x,'ConfidenceLevel',p);