8 - Time-varying ‘signals’ Physics 257 Lecture 7: Basic...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Time-varying ‘signals’ Physics 257 Lecture 7: Basic Time-Series Analysis: Introduction to the Fourier Transform Prof. M. Dobbs, Physics 257 Nov 6. 2008 2 Time-varying ‘signals’ Time Domain Waveform A time domain waveform is just the magnitude of some time continuously observable quantity versus time.. A function V(t). V(t). An example is the music recorded on ‘vinyl’ or casette tape. An vinyl’ The electrical signals that control your heart activity The If this data is only sampled at regular time intervals, it If sampled becomes a discrete waveform and has been “digitized”. The digitized” continuous signal becomes a ‘time-series’ time- series’ Like the music on CDs or MP3s. Like Let’s record a waveform, by digitizing it with the computer’s Let’ computer’ microphone and Matlab… Matlab… The timestream will be stored in a .wav file. The Prof. M. Dobbs, Physics 257 Nov 6. 2008 3 Prof. M. Dobbs, Physics 257 Nov 6. 2008 4 0.08 0.06 0.04 The ‘points’ are the time-series representation of my voice, which was sampled (through the microphone) once every ~90 μs (i.e. every 1/11025 s) Matlab demo: Recording my voice through the PC mic. on my laptop, sampling at a rate of 11025 samples/second (Hz). See Matlab code below…. Try it out yourself. I’ll post the code on WebCT “Waveform.m” Time Series Analysis: Intro What is a time-series? What timea time series is a time-ordered sequence of data points, time timewith each data point in the series measured at a successive time. The time interval between measurements is often (but not always) uniform; i.e. a time series is a discrete representation (or ‘sampling’) of a sampling’ continuous varying quantity/signal. Time series analysis comprise the set of methods used Time analysis in order to understand or extract useful information from such time series. In Physics we normally use these methods to extract (or understand) important properties of the ‘signal’ which can tell us a great deal about the signal’ process/object that generated the signal. Such analysis methods can also be used to make predictions into the future based on the past behaviour. behaviour. 5 Amplitude 0.02 0 -0.02 -0.04 -0.06 0.015 0.02 0.025 0.03 0.035 time (s) 0.04 0.045 0.05 0.055 Prof. M. Dobbs, Physics 257 Nov 6. 2008 Prof. M. Dobbs, Physics 257 Nov 6. 2008 6 1 The ‘frequency domain’ There is an important/complementary perspective to There the time domain view of a waveform: The The frequency domain (or Fourier domain in honour of Joseph Fourier who introduced these ideas) It can be difficult and clumsy when you first start to It think in the Fourier domain, but it is so essential that it is worth introducing these ideas early and solidifying them in later courses. The Fourier domain often gives a whole new (often The very much simpler) window of understanding into what’s going on. what’ Prof. M. Dobbs, Physics 257 Nov 6. 2008 7 Fourier Theory: The basic idea It is possible to construct any continuous function It from a sum of simple oscillating functions; i.e. a sum of sine/cosine waves of various frequencies… frequencies… The sine waves form a basis set. The Before going into the mathematics, some examples… Before examples… Prof. M. Dobbs, Physics 257 Nov 6. 2008 8 Building a ‘Square Wave’ with a Fourier Series Wave’ We can build up We any waveform from a superposition of sine waves. Let’s build up a Let’ square wave: sine (2π•νt) Fourier Series for periodic waveforms +1/3 sine (2π•3νt) +1/5 sine (2π•5νt) … here is the result with 15 harmonics added. Prof. M. Dobbs, Physics 257 Nov 6. 2008 9 Prof. M. Dobbs, Physics 257 Nov 6. 2008 10 Important Fourier-Fact #2 A Fourier series (discrete) or spectrum (continuous) tells us Fourier which sine/cosine waves we need to add together to “build up” up” the waveform component by component. The sine waves are the basis set. The The Fourier Transform: Continuous, non-periodic nonwaveforms In your other courses you may have learned the definition In of the Fourier Transform of a continuous function f(t): f(t): F (ν ) = Remember Remember ∞ = + + −∞ ∫ f (t )e −i 2πνt dt If you have not seen this before, just think of this as the definition of eiθ ˆ ˆ Just like the x and y vectors form a basis set for a vector in 2Just vector 2D,… sine waves can be used to form a basis set for any generic D,… waveform. =2 ˆ x + ˆ y ˆˆ = 2x + y Prof. M. Dobbs, Physics 257 Nov 6. 2008 11 Mathematically, this integral is the ‘inner product’ of f(t) Mathematically, product’ f(t) with exp(-i2π*ν*t), i.e. the projection of f(t) onto this exp(f(t) (complex) oscillatory function. Thus, the magnitude of F(ν) is related to how much of (or Thus, how large a component of) f(t) oscillates at the frequency ν. f(t) Prof. M. Dobbs, Physics 257 Nov 6. 2008 12 2 The Discrete Fourier Transform F (ν ) = ∞ −∞ So you think you can sing a Sine wave. The best sine-wave that I can sing….. Not quite perfect as you can see from the Fourier spectrum. Mostly 362.7 Hz, but there are some harmonics (i.e. component that are multiples of the ‘fundamental’ – or most prevalent frequency). The second harmonic is at 725.4 Hz and the third at 1088 Hz. 0.1 0.08 0.06 0.04 0.02 0.025 Fourier Spectrum of my Voice 0.03 ∫ f (t )e N − i 2πνt dt dt -> Δt = 1; t -> n; ν-> u/N − i 2π ( u −1)( n −1) N F (u ) = ∑ f (n) × e n =1 , for 1 ≤ u ≤ N Amplitude 0 -0.02 -0.04 -0.06 |Amplitude| This is your time-series, f(n). The series has length ‘N’ (i.e. ‘N’ elements) 0.02 0.015 For the purposes of this course, we won’t dwell on the For won’ mathematics at all… instead we’ll let matlab do the all… we’ mathematics for us and we’ll spend our time gaining we’ some intuition and understanding of the Fourier domain. Prof. M. Dobbs, Physics 257 Nov 6. 2008 13 0.01 0.005 -0.08 -0.1 0.015 0 0 200 400 600 Frequency (Hz) 800 1000 1200 0.02 0.025 0.03 0.035 time (s) 0.04 0.045 0.05 0.055 Prof. M. Dobbs, Physics 257 Nov 6. 2008 14 Simple waveform y = sin (x) sin Unit amplitude sine wave, Unit sampled at 100 Hz, with a period of 1 second. x = [0:0.01:10] ; y = sin(x*2.*pi) ; plot(x,y,'.'), axis([0 5 -1 1]) xlabel('Time (seconds)') 1 0.5 Fourier Transform Time domain waveform 0 FOURIER TRANSFORM -0.5 What is the Fourier What Transform? 1 0.5 Fourier Domain [mag, freq]=powerSpectrum(y, 100 ) ; plot(freq,mag,'-') -1 0 2 4 6 Time (seconds) 8 10 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0 -0.5 0.2 0.1 0 -1 0 2 4 6 Time (seconds) 8 10 0.5 1 1.5 2 frequency (Hz) 2.5 3 3.5 16 Prof. M. Dobbs, Physics 257 Nov 6. 2008 15 Prof. M. Dobbs, Physics 257 Nov 6. 2008 Fourier Transform 1 So far we’ve learned that FT(sine wave) So we’ Single Freq. Single 0.5 0 FOURIER TRANSFORM -0.5 time frequency -1 0 2 4 6 Time (seconds) 8 10 0.9 0.8 0.7 The Fourier transform of a sine wave is a single spike (or delta function). It peaks at one specific frequency, corresponding to the period of the sine wave. The Fourier transform of a sine wave simply determines it’s frequency. 0.6 0.5 0.4 0.3 0.2 0.1 0 0.5 1 1.5 2 frequency (Hz) 2.5 3 3.5 17 What about noise? No signal can be detected perfectly What cleanly… there is always some source of noise. Think of this cleanly… as a small (or sometimes large!) additional contribution to the signal being detected. Random noise oftentimes satisfied the central limit theorem (since it results from a sum of many contributions), and obeys a Gaussian distribution… let’s distribution… let’ generate some and see what it’s Fourier Transform is. it’ Prof. M. Dobbs, Physics 257 Nov 6. 2008 Prof. M. Dobbs, Physics 257 Nov 6. 2008 18 3 Random Noise Time domain noise Time 3 2 1 Amplitude (Volts) Amplitude (Volts) Random Noise Time domain noise Time 3 2 1 noise = randn(1,1000) plot(noise) [mag, freq]=powerSpectrum( noise, 1 ) ; plot(freq,mag,'-') xlabel('frequency [Hz]') 0 0 -1 -1 -2 -2 The Fourier transform of a Gaussian random timestream (random noise) is WHITE. It’s Fourier WHITE It’ spectrum contains all frequencies. 1000 -3 0 100 200 300 Fourier Domain Fourier 0.16 0.14 0.12 400 500 600 Time (seconds) 700 800 900 1000 -3 0 100 200 300 Fourier Domain Fourier 0.16 0.14 0.12 0.1 400 500 600 Time (seconds) 700 800 900 0.1 0.08 0.08 0.06 0.06 0.04 0.04 This level is normally called the “noise floor”. It is much floor” more difficult to detect a signal if its amplitude is below this level (as is perhaps obvious!). 0.35 0.4 0.45 0.5 0.02 0.02 0 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Prof. M. Dobbs, Physics 257 Nov 6. 2008 0 0.05 0.1 0.15 19 0.2 0.25 0.3 frequency [Hz] Prof. M. Dobbs, Physics 257 Nov 6. 2008 20 Example: here is some really noisy data… is there a Example: data… correlated waveform hidden beneath the noise? Let’s Let’ decompose the timestream in term of its Fourier components and see if one frequency stands out… out… 0.8 0.6 0.4 0.035 amplitude (volts) amplitude (volts) 0.2 0 -0.2 -0.4 0.01 -0.6 0.005 -0.8 0 0.005 0.01 0.015 0.02 0.025 0.03 time (seconds) 0.035 0.04 0.045 0.05 0 0.03 0.025 0.02 0.015 0.05 0.045 0.04 Yes… there is a strong signal at 1 kHz. S/N ≈ 5 0 500 1000 1500 2000 2500 3000 Frequency (Hz) 3500 4000 4500 5000 Prof. M. Dobbs, Physics 257 Nov 6. 2008 21 4 ...
View Full Document

Ask a homework question - tutors are online