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

    %% Periodogram of Relative Sunspot Numbers
% Obtain the periodogram of the Wolf (relative sunspot) number data sampled
% yearly between 1700 and 1987.

% Copyright 2015 The MathWorks, Inc.


%%
% Load the relative sunspot number data. Obtain the periodogram using the
% default rectangular window and number of DFT points (512 in this
% example). The sample rate for these data is 1 sample/year. Plot the
% periodogram.

load sunspot.dat
relNums=sunspot(:,2);

[pxx,f] = periodogram(relNums,[],[],1);
plot(f,10*log10(pxx))
xlabel('Cycles/Year')
ylabel('dB')
title('Periodogram of Relative Sunspot Number Data')

%%
% You see in the preceding figure that there is a peak in the periodogram
% at approximately 0.1 cycles/year, which indicates a period of
% approximately 10 years.