1 / 11

How to make a power spectra

How to make a power spectra. And discover something we don't understand well!. You will use a function I wrote, powerest.m, because it is easier to use and better documented than those in Matlab. function [pspecest,freqest,EDF,VAR]=powerest(tseries,taxis,nlength);

naeva
Download Presentation

How to make a power spectra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to make a power spectra And discover something we don't understand well!

  2. You will use a function I wrote, powerest.m, because it is easier to use and better documented than those in Matlab. function [pspecest,freqest,EDF,VAR]=powerest(tseries,taxis,nlength); %return power spectrum [pspecest,freqest,EDF,VAR]=powerest(tseries,taxis,nseg); % % demeans the data before it runs. % % nseg is the length of the segments to be used in averaging % they will overlap by half their length and have a welsh window. % only works on evenly spaced data. frequency is in real, not angular % units. % % It also returns the scalar EDF, the estimated degrees of freedom for each % non-nyquist estimation, assuming Gauusian inputs as in Welch in Childer's % Modern Spectral Estimation % % it also returns the variance for each data point in the vector VAR % BOTH OF THESE ASSUME GAUSSIAN DISTRIBUTED RANDOM DATA!!!!! see Welch % in Childer.

  3. What are the inputs? [pspecest,freqest,EDF,VAR]=powerest(tseries,taxis,nseg); • tseries: A vector of data • taxis: the times the data was taken • nseg: the length of the averaging window in datapoints. Must be even! • What are the outputs? • pspecest: the power spectrum • freqest: the frequencies of pspecest, in units of 1/(units of taxis) • EDF, degrees of freedom in estimate of pspecest (you can ignore this for now) • VAR, the std2 of the error in pspecest.

  4. One big warning • data and time input into powerest.m must be vectors with 1 row and many columns • So if >> size(t) ans = 220751 1 >> size(BP) ans = 220751 1 • Then you would call powerest with [psd,freq,edf,var]=powerest(BP',t',nseg);

  5. So how do you use it? • I have several decades of atmospheric pressure from Duluth, MN:

  6. What periods am I interested in? • Annual period and smaller • So average over 3 to 5 year window • Good rule of thumb: window should be three to five times length of longest period you care about, if you can. %plot barometric pressure spectra clear all clf() load disw_BP_clean %compute power spectra nseg=1*24*365*3; [psd,freq,edf,var]=powerest(BP',t',nseg); %plot data semilogy(freq,psd,'linewidth',1) hold on xlabel('frequency, 1/period so 1/days') ylabel('power') %plot error semilogy(freq,psd-sqrt(var),'r--' ,freq,psd+sqrt(var),'r--')

  7. This gives you (without the error bars):

  8. How do we see the low frequencies? • axis command returns axis limits and sets them • takes and returns: [xmin xmax ymin ymax] • So to get the existing limits, and set the x axis limits to be between 0 and 1/90 days-1 (explain) temp = axis; axis([0 1/90 temp(3:4)]); % explain! • Not much interesting at low frequency • Note annual. • Define red! • What would I do if I cared more about low frequencies?

  9. What is up at high frequencies? • explain what the spikes mean • What is an "Atmospheric tide"?

  10. What does the tide look like in time? • how did I calculate it? • remember GMT! • What causes it? • Not super strong! • Rule of thumb that will be important in homework. If you have a signal that repeats over a period P, it will show up in the spectra at • Periods P, P/2, P/3, P/4,P/5 and so forth • Frequency 1/P,2/P,3/P,4/P,5/P and so forth. • Explain!

More Related