%** create plots of power specra for paleoclimate data sets % with UNIFORM sample interval % % this script uses quick and easy function f_powerspec % [freq, pow]=f_powerspec(SDATA, SF) % % SDATA: equally-spaced (in time) samples % SF: sample frequency % freq: frequency spectrum % pow: signal power at those frequencies % % this script uses function f_autorcorr % R=f_autorcorr(SDATA, SF) % % R: level of correlation at a range of lags % 1: lag in time units % 2: correlation % % detrend the data to clean up the analysis % buit-in Matlab detrend takes flags 'constant' and 'linear' %* select time series ts=detrend(T_akureyri(2:128,2),'linear'); % dependent variable tst=T_akureyri(2:128,1); % independent variable (time) sf=tst(2)-tst(1); ttl='Akureyri January temperature'; fn=100; % figure number %* compute correlation and plot the result autoC=f_autocorr(ts,sf); [fSPAC, pSPAC]=f_powerspec(autoC(:,2), sf); figure(fn) subplot(3,1,1) plot(tst,ts, '.m-') ylabel('data'); xlabel('time') title(ttl) subplot(3,1,2) plot(autoC(:,1), autoC(:,2), 'm-') grid on ylabel('correlation'), xlabel('lag') subplot(3,1,3) plot(fSPAC(2:length(fSPAC)), pSPAC(2:length(fSPAC))) grid on ylabel('power') xlabel('frequency spectrum of autocorrelation (cycles/a)')