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

    %% PSD via Periodogram
% Generate a cosine of frequency 200 Hz sampled at 1 kHz for 300 ms. Add
% Gaussian white noise. View its power spectral density estimate generated
% with the |periodogram| algorithm.

% Copyright 2015 The MathWorks, Inc.


%%

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

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

%%
% Refer to the reference pages for each estimation method for more
% examples.