% This program is given as an example to compute the fft power spectrum for
% a real signal
%  
% .............................................................................
% References: 
%
% Zhou YH, SalsteinDA, Chen JL, Revised atmospheric excitation function series 
%     related to Earth's variable rotation under consideration of surface topography, 
%     Journal of Geophysical Research, 111, D12108, doi:10.1029/2005JD006608, 2006.
%
% Jenkins GM, Watts DG, Spectrum analysis and its applications. Holden-Day
%     Press, California, 1968.
% .............................................................................
%
% Yonghong Zhou, Feb.2009, at Shanghai Astronomical Observatory 
%
function sample
fprintf('As an example, the sampling interval is assumed to be 1 day \n');
fprintf('Please enter 1  \n');
t=[0:1000]'; 
% sampling interval=1
x=sin(2*pi/20*t)+randn(length(t),1);
s=fftspectrum(x);
xlabel('frequency (cycles per day)');
% For example, if the unit of sampling interval is "day",
% then, the unit of frequency is "cycles per day". 
%
ylabel('db'); 