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

    %% Spectral Content of Sinusoid
% Define a cosine of 200 Hz embedded in white noise.

%%

Fs = 1000;
t = 0:1/Fs:.3;
x = cos(2*pi*t*200)+randn(size(t));

%%
% View the spectral content of the signal using the Welch algorithm.

Hs = spectrum.welch;
psd(Hs,x,'Fs',Fs)