www.gusucode.com > signal 案例源码程序 matlab代码 > signal/MeanSquareSpectrumOfSinusoidsExample.m

    %% Mean-Square Spectrum of Sinusoids
% Create a signal consisting of two sinusoids in additive noise.

Fs = 32e3;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*t*1.24e3)+cos(2*pi*t*10e3)+randn(size(t));

%%
% Compute the one-sided PSD estimate of the signal. Use the result to
% construct a |dspdata| object. Plot the mean-square spectrum.

P = periodogram(x,[],[],Fs);

Hmss = dspdata.msspectrum(P,'Fs',Fs,'spectrumtype','onesided'); 

plot(Hmss)