Presentation is loading. Please wait.

Presentation is loading. Please wait.

GG313 Lecture 23 Nov 15, 2005 Spectral Analysis 1.

Similar presentations


Presentation on theme: "GG313 Lecture 23 Nov 15, 2005 Spectral Analysis 1."— Presentation transcript:

1 GG313 Lecture 23 Nov 15, 2005 Spectral Analysis 1

2 To date, we have been dealing with data, time series in particular, in the TIME DOMAIN. This just means that our information consists largely of parameters that change in amplitude with time or in space. So out independent variable has usually been time or distance. There is a whole other world out there where we instead study data where the independent variable is frequency, or how many cycles there are in a unit time, or in a unit distance. This is called the FREQUENCY DOMAIN. While we can gain considerable insight about the phenomena hidden in our data in the time domain, we can often learn much more - and apply different and important operations - in the frequency domain. The way we get back and forth between the time and frequency domains is the Fourier Transform, and that is the subject we will be discussing for the next 3+ weeks.

3 Subjects that are highly involved with spectral analysis in the frequency domain include: data compression - jpeg and mpeg differential calculus filtering extraction of signals from noise communications theory and many many others Geological applications include: mapping analysis of gravity and magnetic data seismic processing, and many others.

4 Many signal in geosciences vary with time and/or location as a result of modifications imposed by their passage through time and space. These modifications are caused by variations along the paths taken, and analysis of these signals can often lead to deductions about what these variations are. For example, changes mass within the earth cause changes in the gravitational acceleration which in turn cause satellites to change their orbits slightly. We can measure these changes and analysis leads to estimates of the variation of mass density within the earth. Lets start with the basic trigonometry. We need a good way to describe the variations of a signal, and for that we turn to the sine and cosine functions. We will try to describe our series of numbers in terms of sines and cosines. Think of a vector going around in a circle around the origin:

5 The vector r rotates around the origin with a frequency, f, cycles per sec (Hertz) or a period of T sec/cycle. f=1/T. The variation of x with time is given by x(t)= r cos(2 π f t) and the variation of y with time is given by y(t)=r sin(2 π f t). Instead of f, we can use angular frequency  =2 π f, where  has units of radians/time, so x(t) =A cos (  t). For spatial data, the independent variable is length, and angular frequency becomes the wave number k=2π/, where is the wavelength, with units of distance. The amplitude of the signal is r, the length of the rotating vector.

6 The value inside the parentheses of the sine and cosine is called the phase, measured in radians in most cases, or degrees. (This is slightly different from Paul’s definition). We can change the phase of a sine or cosine wave by adding a constant to to the phase: The new wave has the same shape and amplitude, but it is shifted in phase by .

7 A trig identity allows us to describe this ugly non-linear wave as the sum of two different linear waves: (5.51) (5.52) Signals generally are made up of a sum of many different sinusoids with different phases, periods, and amplitudes. We can represent any signal as a sum of sinusoids, the Fourier Series: (5.53)

8 Since the Fourier series is made up of an infinite number of k’s, solving it for the a’s and b’s is difficult…. but we take advantage of a fundamental characteristic of these series that concerns harmonics. A harmonic is a wavelength (or frequency) that fits an exact integral number of times in a finite-length time series. The fundamental frequency is the one lowest frequency where only one wavelength fits into the time series. If our time series is 20 seconds long, then the fundamental period is T=20 seconds. The fundamental period in this case is f f =1/T=0.05 Hz. If our time series is 20 km long, then the fundamental wavelength is 20 km, and the fundamental wave number is k=2π/20. The next higher frequency that fits integrally into the time series has a frequency of f=2f f. This is usually called the 2nd harmonic.

9 This chart shows the fundamental and first harmonic sine and cosine components for a 64-point series (k f =2π/64, y=sin(kj)). Adding together harmonics will always result in a function that is periodic with a period of the length of the series.

10 In the figure above, n is the length of the discrete time series. How many frequencies do we need to get an absolutely perfect reconstruction of those n points? Since there are n points, we might guess that we need n frequencies, but note that each frequency has two coefficients associated with it, a i and b i, so you might guess that we need n/2, which is almost correct. We will show later that we actually need n/2+1 if the points are evenly spaced, and T=n  t. We’d like to find the best-fit curve to our time series by adding up all the components and solving for the a i and b i. If n is even: (5.59)

11 We thus have an equation for each point in the series and thus n equations with n unknowns. We should thus be able to solve for each coefficient. We could do this by matrices in Matlab: (5.61) which is our standard Ax=b, but that could lead to some huge matrices and lots of compute time. Lucky for us, the properties of sines and cosines and harmonic functions lead to a much faster and analytic way to calculate the coefficients. The important property is that sines and cosines and all their harmonics are orthogonal, so we can calculate each coefficient individually since they are all independent.

12 The a 0 term is the “zero frequency” term, equal to the average of the whole time series, i.e. the mean. The last cosine term (for n even) is there because the sine term of the highest frequency (n even) is zero. Paul goes into the reason for this in his notes. Each frequency in our series is: (5.70) The HIGHEST frequency in our series is This is the Nyquist frequency, equal to half of the sampling frequency. It is very important and will be looked at later.

13 From the orthogonality relationships between sines and cosines, we can solve separately for the a i ’s and b i ’s: The Fourier series can be rewritten: (5.77) (5.94) (5.98) We can go back to y using eqn 5.59.

14 Example: Calculate the Fourier series for y=[1 0 -1 -1 1 2 1 0.5] T with  t=1. For this series, n=8 and T=8 since  t=1. The Fourier frequencies = 2πj/T = 0, π/4, π/2, 3π/4, π The coefficients are (from the equations on the last slide): a 0 = 0.3125 a 1 =-0.0884 a 2 =0.7500 a 3 =0.0884 a 4 =-0.0625 b 1 =-1.3687 b 2 =0.625 b 3 =0.1313 and our series is: y(t)=0.3125 -0.0884cos(πt/4) +0.7500cos(πt/2) +0.0884cos(3πt/4) -0.0625cos(πt) -1.3687sin(πt/4)+0.625sin (πt/2)+0.1313sin (3πt/4) (red numbers are in error in Paul’s notes)

15 %FourierEx5_5 % %Fourier example 5.5 Wessel y=[1 0 -2 -1 1 2 1 0.5]'; % This is the time series n=8; T=8; unit=ones(1,8); % unit vector time=[0:7]; % time vector ( delta t =1) omega=(2*pi/T)*[1 2 3 4]; % frequency vector % get coefficients (eqns 5.94 and 5.98) for ii=1:n/2 a(ii)=(2/n)*(cos(omega(ii)*time)*y); b(ii)=(2/n)*(sin(omega(ii)*time)*y); end a b % divide the 0th and nth coef by 2 a0=(2/n)*(unit*y)/2 % this is the DC (average) value of y a(4)=a(4)/2

16 % calculate inverse to check y for ii=1:8 t=ii-1; y(ii)=a0 +a(1)*cos(omega(1)*t) +a(2)*cos(omega(2)*t)... +a(3)*cos(omega(3)*t)+a(4)*cos(omega(4)*t)... +b(1)*sin(omega(1)*t)+b(2)*sin(omega(2)*t)... +b(3)*sin(omega(3)*t); end y y comes out exactly what we started with.

17 There are several different ways of formulating the Fiurier series. The Matlab function “fft” (Fast Fourier Transform) does it in a different way. In Matlab, Y=fft(x) is the “forward” transform, and x=ifft(Y) is the inverse transform, and: In-Class exercise: If we apply these functions to the example, what do we get? y=[1 0 -2 -1 1 2 1 0.5] Apply fft and follow with ifft to see if the original series is returned.

18 The transform series we get from fft doesn’t look anything like the coefficients in Paul’s notes. How are they related? >> fft(y) ans = 2.5000 -0.3536 + 5.4749i 3.0000 - 2.5000i 0.3536 - 0.5251i -0.5000 0.3536 + 0.5251i 3.0000 + 2.5000i -0.3536 - 5.4749i There series is complex and symmetric around the center value, so there are only 8 independent values (as there should be). And the inverse transform returns the original series, as it should. How are these values and Paul’s related? next class…


Download ppt "GG313 Lecture 23 Nov 15, 2005 Spectral Analysis 1."

Similar presentations


Ads by Google