0% found this document useful (0 votes)
69 views

Spectral Analysis

1. In spectral analysis, the power spectral density measures the contribution of different frequency components in terms of variance per unit frequency. Cross-spectra measure shared power between two time series. 2. When taking the Fourier transform of a time series, padding the series with zeros can increase frequency resolution and reduce spectral leakage between bands. 3. Error bars for spectral estimates are based on the chi-squared distribution, with confidence intervals determined by the degrees of freedom of the estimate.

Uploaded by

Patrick Sibanda
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Spectral Analysis

1. In spectral analysis, the power spectral density measures the contribution of different frequency components in terms of variance per unit frequency. Cross-spectra measure shared power between two time series. 2. When taking the Fourier transform of a time series, padding the series with zeros can increase frequency resolution and reduce spectral leakage between bands. 3. Error bars for spectral estimates are based on the chi-squared distribution, with confidence intervals determined by the degrees of freedom of the estimate.

Uploaded by

Patrick Sibanda
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

In spectral analysis contributions of different frequency components are measured in terms of the power spectral density.

Cross spectrumshared power between two coincident time series. The word is carry over from optics. Red, white and blue are often used to describe spectral shape. In ocean long-period variability tends to be red. Instrument noise tends to be white lue spectra confined to specific frequency bands such as wind-wave spectra.

ft Y ( f ) = y ( t )e i 2 dt

ft y ( t ) = Y ( f )e i 2 df =

1 Y ( w )e iwt dw 2

w =2 f

!"ometimes I get sloppy and use rather then f but forget to use the #) Se=Y(f)Y*(f)=|Y(f)|2 Energy spectral density

| Y ( f ) |

df =| y ( t ) | 2 dt

Parsevals !eore"

$%!f&$# is energy per unit spectral density, when multiplied by df yields the energy in each spectral band centered around fo Sf f = total signal variance wit!in t!e fre#$ency %and f centered at fo. (&eep t!is st$ff on t!e %oard w!ile disc$ssing '' (so t!at w!en s!owing t!e fre#$ency resol$tion of t!e '' yo$ can point to fre#$ency %ands).

'

'' asicially brea(s the time series into even and odd parts and performs )ourier analysis on each one. *on+t really now how it wor(sthe discrete )ourier transform !write on the board& provides the necessary intuitive framewor( for the ))T. If you really want to (now how it wor(s see section ,.-.,. )asthow fast. *)T/ 0# ))T/10log!0& '222 points '1 times faster '2,222 points '3, times faster ' million points 4 '2,222 times faster 5ow to do it in 67T87 . "/fft!9&: Requires power of two data points 6atlab routine can deal with non-powers of twobut slows it down !5owever based on my e9perience I find that in does not slow it down as nearly as much as theory predicts&. "lowest when 0 is a large prime number. ;ne standard option is to pad time series with <eros, i.e. % / fft!=,n& returns the n-point *)T. If the length of = is less than n, = is padded with trailing <eros to length n. If the length of = is greater than n, the sequence = is truncated. >hen = is a matri9, the length of the columns are ad?usted in the same manner. % / fft!=,@A,dim& and % / fft!=,n,dim& applies the ))T operation across the dimension dim. In addition to increasing computational speedpadding with <eros will increase frequency resolutionand if the number of <eros is ?udicisously chosen you can reduce spectral lea(agewhich will be the main topic of today+s lecture.

)requencies that the )ourier transform will resolve are 'BT, #BT, 3BT---0B!#T&. The last period being the 0yquest frequency determined by the frequency of the sampling. 0ote the period between )ourier components decreases with increasing frequency. 0/' !for a ' year record& ' year, C year ut for 0/1DE2 3D22F!'-1ED2B1ED'& 4 C second

"o if you need to resolve two closely spaced frequencies !at periods T' and T'& the record length must be long enough that somewhere in the spectrum. n) = 1) 1 (n*1)) =1) 2 where T is the length of the record and n is the nth )ourier frequency "o =n 1 (n*1))n 1=1) 2 n*1)n= 1) 2 n*1=n 1) 2 n(1+ 1) 2)=+1 n=1)( 1) 2 ,1)

n 1 1 = = T1 T T1 ( 1)T T2 T1 = ( T1 1)T T2

T =

T1 T1 ( 1) T2

"o to resolve two frequencies T' and T# the record length must be at least that long. Consider the case of the 6#, "# Tidal constituent T'/'#.-# T#/'#.22 /'-.E days In the case of the G' !#-.2E hours& and H' !#3.I3 hours& the record length would need to be 'E' days long. 7nd these are minimumusually you can-not distinguish between ad?acent frequency bands because of statistical reasons !later we+ll conclude that we need to average frequency bands to gain statistical confidence& and lea(age between frequency bands. Spectral -ea.age
t S ( f ) = f ( t ) * e i dt

/ote t!at in last class 0 raised t!e e1ponent to i2 f , different notation %eca$se f =1) w!ile =2/. 0ts t!e sa"e t!ing2 3onsider f!t&/cos(t& >e (now what the spectral characteri<ation of this should loo( li(e spectral pea(s at and .

5owever, if we ta(e a time limited sample of f!t&, which must be the case because we don+t have forever, the )ourier transform of a gated sin function would be
T )2

S( f ) =

T ) 2

cos( t ) * e
4

it

dt

= =

1 ( e io t + e io t ) * e it = (e i (o ) t + e ( io + ) t )dt 2 T) 2 T ) 2 1 e i (o )T ) 2 e i (o )T ) 2 e i (o + )T ) 2 e i (o + )T ) 2 + 2 i ( 4 ) i ( + o )

T )2

T )2

1 i 2 sin(( 4 )T ) 2) i 2 sin(( 4 )T ) 2) + 2 i (4 ) i ( 4 ) T sin(( 4 )T ) 2) sin(( 4 )T ) 2) + 2 ( 4 )T ) 2 ( 4 )T ) 2 T (sin c6( o )T ) 25 + sin c6( o + )T ) 25 2

3!ec. t!e sign on 2nd ter"

0ote Jeros at 'BT,#BT,3BT *raw !or show overhead& 7s T goes to infinity, you end up with an infinity tall spi(e within in an infinitally small frequency band and the <ero+s become infinitessmally close together.

'& "how )ourier Transform of gated cos!omt& to further emphasi<e that gated time series distort it+s frequency content. The <eros in this function are at !-nBT&these are the )ourier frequencies. >hen we ta(e a spectrum of a discrete series, )ourier coefficients are also at discrete frequencies it+s not a continuous function. "o if the is at a )ourier frequency ! this would be very ,

fouriertutitus& then the spectrum will not be contaminated by this side lobe lea(age. 5owever, this is rare, and the frequencies

Section 7.8 Remove the mean and trend from the data otherwise it will distort the low frequency end of the spectrum.

"how e9amples of ))T on pro?ector. "how e9amples of *)T of sin curve at a <ero in the window "how e9ample of *)T of sin curve whose frequency is not at a <ero !this is generally the case&. lea(Ke9ampKdft lea(Ke9ampKfft Things that can be done. '& "elect record length so that main spectral quantity is at fourier frequency #& Remove clear harmonics with 8east-"quares )it !Grewhitening& 3& Lse a tapered window !5anning for e9ample&

90/:;9S

<eal =eop!ysical :ata /ot p!ase loc.ed> :' or '' %rea.s down. /eed to loo. at it in a statistical sense. !is is done %y ta.ing '' of S11> rat!er t!an ti"e series.

!"5;> )IMLRN ,.D.3 from boo(& 7 autocorrelation function that slowly de-correlates with lag would be characteristic of a spectra with low frequency variabilityand little high frequency variability to cause the autocorrelation to decrease will have a narrow spectral distribution. !show 67T87 t/2O'22: y/e9p!-tB32&: In contrast a correlation function that quic(ly de-correlates with lag would be characteristic of a record with a numerous frequencies that quic(ly interfere and this would have a wide spectral distribution. 5old on !show 67T87 t/2O'22: y/e9p!-tB3&: In the case of a harmonic the autocorrelation would also show harmonic variability and the spectrum of this would be a line spectrum

.. and this defines the spectrum for a stochastic process in terms of a power density, or variance per unit frequency.

The one sided power spectral density M(, for an autocovarience function with a total of 6 lags is found from the fourier transform of the autocovariance function
M

G k = 2t C yy ( m )e i 2km ) M
m =1

(/2,',#,P.,0B#

!e Periodgra" ?et!od

The original time series can b padded with <eros !HQ0& after the mean has been removed from the data.

The two sided power spectral !or autospectral& density for frequency f in the 0yquist interval R'B#t Q f Q 'B#t is
2

S yy ( f ) =

n =N +K 1 1 t y n e i 2fn dt ( N + K ) t n =4

1 2 Y( f ) ( N + K ) t

'or t!e once sided power spectral density f$nction 4@f@1)2:t


G yy ( f ) = 2 S yy ( f )

/ote t!at division %y dt transfor"s t!e energy spectral density into t!e power spectral density. /ote t!at w!en yo$ ta.e t!e '' in ?A -AB it reports Syy in / fre#$encies 4> /)2 (t!is is /)2 *1)> t!en again fro" /)2+1 %ac. to 2

:raw a1is on %oard(s!owing 1+14 wit! /y#$ist on 7 !e total energy in t!e intervening fre#$encies %etween 4 and ' re#$ire folding t!is in !alf All fre#$encies e1pect 4 and /y#$est t!en re#$ire do$%ling to get power i.e. =yy(4)=Sff(4) =yy(1>n+1)=2*Sff(1>n+2) 1

=yy(n)=Sff(n)

Typically you are going to want to plot spectra on a log scale.

This is particularly useful when the spectra has a power low dependence in the form "yy!f&4f-G

0N> 8NCTLRN 7fter introducing a few more concepts !aliasing and error bars on spectra& I will discuss different ways to present spectra. These include Cross-"pectra Co- "pectra and Suad spectra Coherence "quared spectra Rotary "pectra

A-0AS0/= Results from not resolving fluctuations in time series. It results in another frequency masquerading as the unresolved frequency. This problem needs to be resolved at the measurement phase. This is why, for e9ample, current meter data busts averages over a period of time !say five minutes& so that motion associated with waves are averaged out. "how e9ample of daily sea-level observations and the wrong conclusions one would reach from such a time series. If the original time series has frequencies higher than nyquest aliasing can be a problem.

N9amples include slow reverse rotation of wheels in movies. The energy from the unresolved high frequency folds into the lower frequency component of the spectra

E<<;< BA<S "ince the spectrum plots variance we use the chi-squared statistical model to generate error bars. The Chi-squared is used to determine confidence intervals of the signal variance. )rom which confidence intervals are drawn

(n 1)s 2 nC ) 2
2

s
2

(n 1)s 2 nC ) 2
2

)irst two *efinition of chi-squaredthe mean and the variance

mean = E = The mean value of the chi-squared distribution is equal to the


degrees of freedom

[ ]
2

Variance = E ( ) 2 = 2
)rom this we obtain an estimate of the error in the spectrum.
Var (G yy ( f ))1 ) 2 G yy ( f )

EG yy ( f )D =

2 2 =

The variance of the chi-squared distribution is twice the degrees of freedom "o for n/# the standard deviation is equal to the meannot very good estimate.

'2

>hat we do is average either in the frequency domain ! and averaging&or bloc( average. and 7veraging -- e9plain loc( 7veraging !what "GNCTRL6 does& rea( record into H bloc(s and ta(e spectra of each This yields #H degrees of freedom for each spectral band. 5owever windowing will change this. >indowing, however reduces the effective length of each bloc( so it is typically recommended to overlap windows by upto ,2T. )or sharply defined windows these can be viewed as independent time series. !In the case of a 5anning window a ,2T overlap will be I#T independent& !here M is used instead of % because we are going to use M as the band averaged spectral estimate. "o for n/# the standard error is onemeaning that the error is equal to the estimate. If however we average bands, or brea( the data into segments using 0s independent segments each segment adds two statistical degrees of freedom to the estimate.

EG yy ( f )D = n n

where n/# times number of segments or bloc( averages. ased on what we+ve seen before with the use of the chi-squared for error estimates we can now place confidence limits on M99!f&, i.e.

(n 1)= yy (f ) nC ) 2
2

= yy (f )

(n 1)= yy (f ) nC ) 2
2

''

"o the true spectrum falls in the interval described above within the confidence limits chosen. This can be used to determine if a pea( in the spectrum is significant. 0ote that we want to be careful how we determine degrees of freedombased on the windowing !table ,.D.-& )or e9ample the degrees of freedom of a 5anning >indow is 1B3 0B6 where is the number of data points in the time series and 6 is the half window width in the time domain. "o if 0/.' 6 the effective degrees of freedom for a 5anning window is #.DD time the number of windows. This is why we can overlap windows.

3o Spectra 3ross Spectra

Ta(ing the cross spectrum is quite easyidentical to autospectra. '& Nnsure that the time series span the same timeBspace period with identical resolution. #& Remove the means the trends from both records 3& *etermine how much bloc( averaging you will need to do for statistical reliability. -& >indow the data ,& Compute ))T of data D& 7d?ust scale factor of spectra according to windowing E& Compute raw one-sided cross spectral density
G12 ( f ) = 2 X *1 ( f ) X 2 ( f ) Nt

Since t!e cross+spectr$" is t!e transfor" pair of t!e covariance f$nction the inverse 'o$rier transfor" of t!e cross+spectr$" will recover t!e cross+ covariance f$nction. This is a more computationally efficient way to calculate the cross-covariance due to the robust computational efficiency of the fft.

'#

i.e. inv!M'#&/ cross-covaraines in matlab two time series 9' U 9#. )/fft!9'& M/fft!9#&: CC/ifft!con?!)& M&

wo ways to #$antify t!e real and i"aginary parts of t!e cross+spectr$". '& product of an amplitude function !Cross amplitude spectrum& and a phase function ! phase spectrum& The amplitude spectrum gives the frequency dependent of co-amplitudes, while the phase indicates the relative phase between these two signals. >hen the co-amplitudes are large-that means that there are covariance in that frequency bandand the phase is meaningful. 5owever if the amplitude is small !specifically statistically insignificant& then the phase is meaningless. !0eed to discuss significance levels for this&. "o the amplitude is simply MFcon?!M& 7nd the phase is 7tan#!imag!g&, real!M&& Nasily done in 6atlab 9(!t&/7(cos!#fotV) =1,2 The )ourier transform of this is the sinc function that is shifted by ei !note that for <ero phase shift e2 is '&

'3

i.e. =(!f&/7(B#!ei(sinc!f- fo&TV e-isinc!fV fo&T& (/ ',#

5ence the cross-power+spectra of these two time series would be "'#!f&/ 'BT !='!f& =F#!f&&

S 12 (f ) =

A 1 (f )A 2 (f ) i1 e sin c(f f o ) + e i1 sin c(f + f o ) + e i21 sin c(f f o ) + e i2 sin c(f + f o ) F

)or T going towards inifinity


S 12 ( f ) = A1 A2 i ( ) e ( f f o ) + e i ( ) ( f + f o ) 2T

6ore generally the sample cross-spectrum !one-sided& would read


S 12 (f ) = or A 1 2 (f ) A1A 2

[e

i 6 1 ( f ) 2 ( f )5

S 12 (f ) =

[e

i12 ( f )

"o 7'# is frequency dependent amplitude of the cross spectrum and theta is the frequency depended phase of the cross spectra. The phase only has meaning when the amplitude is significantly different than <ero.

It can also be decomposed into a co+spectr$" !in phase fluctuations& and #$ad+ spectr$" !fluctuations that occur in quadrature&. This is also related to the Rotary spectra that can decompose the cross-spectra of a vector time series into cloc(wise and countercloc(wise rotating components. !later&.

'-

3o+Spectra and G$ad Spectra. 5eat flu9 e9ample. Imagine you had time series of velocity and temperature R if fluctuations occur in phase !large co-spectrum amplitude& then there will be a large eddy heat flu9. In contrast if the co-spectrum is small but the quad-spectrum is large there will be little eddy heat flu9 at that frequency. This of course could be induced by the amplitude and phase spectrumsbut often this is a convienent way to plot it.

5ere the cross "pectrum, which has a real and comple9 part, is used to calculate the cospectrum and the quad spectrum.

S 12 (f ) = 3 12 (f ) iG 12 (f ) w!ere 312 (f ) = A 12 (f ) cos 12 (f ) G 12 (f ) = A 12 (f ) sin 12 (f )

3o!erence spectr$" (3o!erency or S#$ared 3o!erency)

',

'# # !f & =

$ "'# !f & $ # "'' !f &" ## !f & $ C # !f & + S # !f & $ "'' !f &" ## !f &

'# # !f & =

2 <$ #'# $< ' and

'# !f & =$ '# # !f & $' B # e i'# !f &

The squared coherence represents the fraction of variance in 9' ascribable to 9# through a linear relationship between 9' and 9#. Ghase estimates are generally unreliable when amplitudes fall below the I2-I,T confidence intervals.

Confidence Intervals

' # = ' ' B! N*;) '&


N*;) is the independent cross-spectral reali<ations in each frequency band. Thomson and Nmery suggest that it is equal to the number of frequency bands that you average.

)or I, T confidence level /2.2, )or N*;)/#

' # !f & = ' ' B!N*;) '&

'D

# I, = 2.I,

Requiring remar(ably high coherenceWW 5owever for N*;) /,


# I, = 2.,3

7 limit that is more li(ely to be e9ceeded in a noisy geophysical data setW

<otary Spectra Rotary spectra is applied to a vector time series !such as current or winds& and is similar to the ellipse analysis that we did earlier in the semester. If you recall we did this first by decomposing a velocity vector time series into a cloc(wise and countercloc(-wise rotating motion. )or the ellipse estimate these were obtained by a least squares fit to find !7, ,C *& at a single frequency. )or rotary spectra this is done for all frequencies--though typically only a few frequencies are of interest in this analyis. L!f&/7!f&cosftV !f&sinft X!f&/C!f&cosftV*!f&sinft This can be written in comple9 form asO R/uViv R/ 7costV sintVi !CcostV*sint& <=(A*i3) cos+ (B*i:) sin t (1)

5ere the 7, ,C,* are obtained from the spectral estimatewith the real being 7 and C and the imaginary being C and *. "ince we are dealing with vector that oscillates at a single frequency this can be represented in terms of a cloc(wise rotating vector and a counter cloc(wise rotating vector.

'E

i.e. R/RVeitV R-e-it >here RV and R- are the radii of the cloc(wise and counter-cloc(wise rotating constituents. Recall eit=costVisint so R= R+( costVisint& V R-( cost-isint& <=( R++ R-) cos t *i( R+- R-) sin t (2)

"olving for RV and R- by equating equations !'& and !#& we findO


R+ = A + D + i (C B ) 2 A D + i (C + B ) 2

R =

The magnitude of these are then


( A + D) 2 + ( C B) 2 = F
1) 2

( A D) 2 + ( C + B) 2 = F

1) 2

'1

"ince these are rotating at the same frequency but in opposite directions there will be times when they are additive !pointing in the same direction& and times when they are pointing in opposite direction and tend to cancel each other out. These two times define the 6a?or 79is is ! RVV R- & and the minor a9is !RV- R-) of an ellipse.

'I

You might also like