Lecture 17 spectral analysis and power spectra
Part 1 What does a filter do to the spectrum of a time series?
Consider a filter f(t), such that y(t) = f(t) * x(t) In the frequency domain, convolution becomes multiplication y( ) = f( ) x( ) and thus |y( )| 2 = |f( )| 2 |x( | 2 frequency bands of x( ) are amplified when |f( )| 2 >1 frequency bands of x( ) are attenuated when |f( )| 2 <1
|x( )| 2 |f( )| 2 |y( )| 2
So how do we tell if a filter will amplify or attenuate a given range of frequencies?
Obviously, we could plot its spectrum … however, a more rigorous analysis of really simple filters offers some insight into what’s going on
Lets examine the DFT formula C k = n=0 N-1 T n exp(-2 ikn/N ) with k=0, …N-1 or since t=2 /N C k = n=0 N-1 T n [exp(-ik t )] n with k=0, …N-1 now let z = exp(-ik t ) = exp(-i t ) C k = n=0 N-1 T n z n with k=0, …N-1 but that’s the z-transform of T So the discrete fourier transform C k of a timeseries T is its z- transform evaluated at z= exp(-ik t ).
The discrete fourier transform C k of a timeseries T is its z- transform evaluated at z=exp(-ik t )=exp(-2 ik ) Note that |z| = 1, regardless of the value of k As you evaluate the coefficients, C k, k varies from 0 to (N-1), z varies from 0 to 2 along a circle in the complex plane real z imag z z
The discrete Fourier transform C k of a timeseries T is its z- transform evaluated at z=exp(-ik t )=exp(-2 ik ) As you evaluate the coefficients, C k, k varies from 0 to (N-1), z varies from 0 to 2 along a circle in the complex plane Hence the coefficients C k are going to be very sensitive to the locations of poles and zeros of T(z), especially when they are close to the unit circle real z imag z pole zero big C k here small C k here
Example f=[f 1, f 2 ] T =[1, -1.1] T f(z)=f 1 +f 2 z so has zero at z=-f 1 /f 2 f=[1, 1.1] T zero
n |f( n )| 2 High Pass Filter n ny
Example f=[f 1, f 2 ] T = [1, 1.1] T zero
n |f( n )| 2 Low Pass Filter n ny
Example f=[1, 1.1i] T *[1, -1.1i] T zeros
n |f( n )| 2 n ny Suppress mid-range
Example: f=g inv with g=[1, 0.6*(1-1.1i)] T * [1, 0.6*(1+1.1i)] T poles
n |f( n )| 2 n ny Narrow bandpass filter
Example f= [1, 0.9i] T * [1, -0.9i] T * inv([1, 0.8i] T ) * inv([1, -0.8i] T ) poles zeros
n |f( n )| 2 n ny notch filter
upshot You can design really short filters that do simple but useful thing to the spectrum of a time series
Part 2 Computing spectra of indefinitely long timeseries
Suppose you cut a section out of a long timeseries, x(t) t How similar is the spectrum of the section to the spectrum of the whole thing? section
Lingo – Stationary Time Series When the statistical properties of an indefinitely long time series don’t change with time, the time series is said to be … … stationary
Power spectrum The standard FT formula C( ) = - + T(t) exp(-i t) dt is not well defined when T(t) wiggles on forever, since T(t) has infinite energy. We need to adapt it.
Power spectrum C( ) = -T/2 +T/2 T(t) exp(-i t) dt S( ) = lim T T -1 |C( )| 2 S( ) is called the power spectral density, the spectrum normalized by the length of the time series. Whenever I say ‘spectrum’ in the context of an indefinitely long stationary time series, I really mean ‘power spectral density’
Relationship of power spectral density to DFT To compute the Fourier transform, C( ), you multiply the DFT coefficients, C k, by t. So to get power spectal density T -1 |C( )| 2 = (N t) -1 | t C k | 2 = ( t/N) |C k | 2 You multiply the DFT spectrum, |C k | 2, by t/N.
Back to the question t You use convolution theorem to analyze the problem (but written ‘backward’) section
The transform of the convolution of two timeseries is the product of their transforms Convolution theorem The product of two timeseries Is the convolution of their two Fourier transforms Last week’s waytoday’s way Swapping the roles of time and frequency are allowed because the Fourier Transform is symmetrical in time and frequency
t boxcar t t windowed time series timeseries =
So what’s the Fourier Transform of a boxcar of length, T? -T/2 +T/2 1 exp(-i t) dt = -T/2 +T/2 { cos( t) – i sin( t) } dt = 2 0 T/2 cos( t) dt = (2/ ) sin( t)| 0 T/2 = T sin( / ( /2) = T sinc( T/2 )
recap Fourier transform of long timeseries convolved with a sinc function is Fourier transform of windowed timeseries
T sinc( wT/2 ) T sinc( T/2) small T big T
As window length T increases Central lobe gets narrower good Side lobes gets narrower good and closer to origin Side lobes get no smaller bad and never go away
Example: sinusoidal timeseries long time series boxcar windowed times series time, t
Spectrum of long time series Spectrum of window Spectrum of windowed time series Yuck!
What to do ? Choose a windowing function that has more desirable properties than a boxcar … Need … finite length in time narrow central lobe in frequency no (or smallish) frequency side lobes
Example: truncated Gaussian ±2 long time series truncated gaussian windowed times series time, t
Spectrum of long time series Spectrum of window Spectrum of windowed time series peaks a bit wider than with sinc
Example: Hamming Taper cos{2 n/(N-1)} long time series Hamming taper windowed times series time, t
Spectrum of long time series Spectrum of window Spectrum of windowed time series
upshot 1. You can’t win. Ringing trades off with width of the central peak. But you can choose how you lose. 2. The spectrum of the windows time series is a ‘smoothed’ version of the true spectrum. The smoothing is being done by the convolution. Thus the error estimates for the windowed spectrum are different from (and generally better than) the error estimates for an unwindowed spectrum