2.39 Tuorial Shee #2 discree vs. coninuous uncions, periodiciy, sampling We will encouner wo classes o signals in his class, coninuous-signals and discree-signals. The disinc mahemaical properies o each, especially in regards o Fourier ransorms, requires us o have a leas a basic undersanding o he dierences beween hem. Firs I will presen some mosly non-mahemaical inuiion, hen discuss some o he heory behind i. This maerial is mean o help you undersand he labs and homeworks. Coninuous-signals have, as heir name suggess, a coninuous independen variable. For example, he velociy o a moving body, like you moving around campus, could be considered a coninuous signal a any ime he velociy is clearly deined. Noaion is he common (), which you are used o rom mahemaics classes. In conras, discree signals are only deined a discree independen variables. For example, he daily high emperaure during a week is only deined or he 7 days. I would make no sense o compare he daily high o day (say Monday) o day.5. Oher examples o discree signals include census daa and class aendance; i you hink abou i here are many ohers. Noaion or discree numbers is ypically [n], wih he brackes emphasizing ha n is a sequence. Graphically: 2 coninuous uncion.5 ().5.5.5 2 2.5 3 3.5 discree uncion [] 5 2 3 4 5 6 7 8 9 The disincion is very imporan o us because when we use compuers o numerically perorm mahemaical operaions we are conined o dealing wih he properies o discree numbers. Tha is because ypical compuers are buil wih digial logic dealing wih ulimaely binary daa. MATLAB can approximae a coninuous
uncion by generaing values a small inervals o he independen variable, bu here is a limi o how much such approximaions acually mirror he real hing. I is ha limi we are ineresed in. Sampling So how do we go rom coninuous o discree signals? In he case o he moving body, i you were o measure he velociy wih a radar gun and wrie down your reading every.5 seconds, you would in ac now have discree daa. We would say ha your sampling requency is 2 Hz, or 2 per second. Ideally, you would wrie down values a exacly every.5 seconds. Mahemaically we can deine his operaion as muliplying an "impulse rain" wih your daa, hen passing i hrough a coninuous o discree converer or C/D converer. Le s examine he siuaion where you are on a swing, racing he moion o a pendulum hus your velociy would be a sinusoid. Your velociy v() is hus equal o sin(). Signal: v sin( ) Impulse rain: p() = or, r, r2, p oherwise Sampled: vp v p velociy (m/s) sampled v() (m/s) impulse (uniless) - 2 2 3 4 5 6 7 ime (s) 2 3 4 5 6 7 ime (s) - 2 3 4 5 ime (s) 6 Perorming his operaion is known as "sampling" he uncion v() a he sampling requency o /ǻt, where T is he period o he impulse rain. Noe ha an impulse rain can also be wrien as,,, 2,... p kt T I you sample v p () by muliplying wih p() you will obain a sampled signal. Noe ha he impulse rain is sill a coninuous uncion alhough i looks discree, since i s deined or every. Also noe ha we are muliplying wo signals in ime, which by he convoluion heorem which we saw in class means he ransorm o v p () equals he convoluion o he signals in requency: V p (:) V (:) * P(:). v p () becomes a discree signal v p []
aer running he signal hrough a C/D converer which will non-dimensionalize ime ino sample numbers (more on his and he convoluion in requency laer). I v() is changing slowly enough or our sample rae o capure all he inormaion conained in he signal, we can compleely reconsruc v() based on he discree sequence v p []. Sop and hink abou his or a while you can exacly reconsruc a uncion v() by knowing an ininiesimally smaller subse o inormaion, as long as your sampling requency is grea enough. The cuo poin is called he Nyquis sampling requency, and i is exacly wice he highes requency you can reconsruc in your signal. This is known as he "sampling heorem": Sampling a F nyquis wih F nyquis > 2* max (where max is he highes requency in your signal o ineres) allows complee reconsrucion o he signal rom is sampled values. A more ormal way o say his (T = period): Sampling Theorem, Oppenheim and Willsky, Signals and Sysems page 58 Le x() be a band-limied signal wih X( : ) = or : > : max. Then x() is uniquely deermined by is samples x(nt), n =, ±, ±2,, i : s > 2 : max where : V ʌ7*lyhqwkhvhvdpsohvzhfdquhfrqvwuxfw x() by generaing a periodic impulse rain in which successive impulses have ampliudes ha are successive sample values. This impulse rain is hen processed hrough an ideal lowpass iler wih gain T and cuo requency greaer hen : max and less hen : s - : max. The resuling oupu signal will exacly equal x(). I your signal conains requencies higher hen hal your sampling rae, hen you are "undersampling" he signal and will no be able o reconsruc i ully. I you ry o reconsruc i anyways you will encouner "aliasing", or disorion o he original signal. I s really useul o look a he graph below o see wha his means i you aren sampling as enough you have no way o knowing i he signal you are observing is he red or blue one. Two dieren sinusoids ha give he same samples; a high requency (blue). (hp://en.wikipedia.org/wiki/aliasing, accessed /5/6). (red) and an alias a Laer we will see wha aliasing looks like in he requency plane. Background Theory
I will presen some basics o help undersand hwk2, bu he ull mahemaics behind i is ouside he scope o his course. A course eniled "Signals and Sysems", or he exbook o he same name by Oppenheim and Willsky (available in he lab) can ill in he blanks i you are ineresed. In class Pro. Manalis inroduced he Fourier Transorm or coninuous signals, and is inverse. We will speciy his ransorm as he CTFT, or Coninuous Time Fourier Transorm. Because MATLAB doesn work wih coninuous signals, when you wan MATLAB o perorm a Fourier Transorm i acually perorms he Discree Fourier Transorm, or DFT. In class we saw his able: Time Frequency Fourier series (CTFS) Coninuous () Discree (w n ) Fourier inegral (CTFT) Coninuous () Coninuous ( : ) Discree Time Fourier Transorm (DTFT) Discree [] Coninous (w) Discree Fourier Transorm (DFT) Discree [] Discree [2*pi*k/N] (I ve added he DTFT) The CTFS maps a coninuous, periodic signal o is harmonic (sinusoidal) componens. This means ha we are WU\LQJWRPLPLFRXUVLJQDOZLWKVLQHVDQGFRVLQHVRILQWHJHUPXOWLSOHVRIWKHIUHTXHQF\LQUDGLDQVȦ n = n : = n*2pi/t. The series o requencies hus presens a discree mapping in requency space. Noe rom he ormula ha he CTFS is aperiodic. a T /2 T T /2 ³ d T /2 a n cos Z n T T /2 d CTFS: T /2 b n sin Z n T T ³ /2 2S Zn n, n,2,3... T ³ d CTFS - (inverse): a a n cosz n b n sin Z n n The CTFT is a generalizaion o he CTFS o include all requencies in he ransorm, no jus ineger muliples. We are aking he ormula or CTFS and aking he limi as T goes o ininiy. Thus he signal in ime no longer needs o be periodic (since he period T is going o ininiy), and in urn we need o use all requencies in order o mimic he signal. The CTFT o a signal is hus coninuous, and also no necessarily periodic. The CTFT ransorms a coninuous ime signal o a coninuous specrum in requency. We represen ha requency as :.
CTFT: H (:) = ³ h()e iw d CTFT - : h() = ³ H (:)eiw d: The DTFT is symmerical o he CTFS. Recall he CTFS maps a periodic, coninuous signal in ime o a discree signal in requency. The DTFT maps a discree signal in ime o a periodic, coninuous signal in requency. The connecion o he CTFT is ha he DTFT acs on a sample o a coninuous signal. I we were o rewrie he CTFS in erms o exponenials (using Euler s Formula, e iz cosz i sinz ) he symmeery would be more apparen, I ll leave ha o you, or you can look up he Srang reerence Fourier Transorms on page 5. DTFT: H e iz h e [] izn DTFT - : h [] S ³ H e iw e izn dz 2 2S All hese ransorms involve coninuous signals in eiher ime or requency space. However as you know compuers in general can only work wih discree inormaion, and addiionally we can only sample or a inie ime. Thus he bes we are able o do numerically wih ransorms is a discree approximaion in requency o a discree signal in ime. This brings us o he DFT. The reerence in he 2.39 schedule page iled FFT reerence maerial conains a more deailed explanaion i you desire. The Discree Fourier Transorm (DFT) Why DFT i we have DTFT? Recall ha DTFT provides a coninuous requency specrum provided ha we are given an ininiely long discree-ime signal. However, in real lie we do no have he luxury o sampling a signal orever. Thereore DFT approximaes he requency specrum o a DTFT using discree samples. The DFT maps a discree, aperiodic and inie signal in ime o a discree, periodic signal in requency. This is somehing compuers can do. The DFT o a lengh N signal in ime will also be o lengh N in requency. In oherwords, i we have a signal o lengh, we could only esimae he enire requency specrum wih samples. Noe ha we have a limied series o requency values in he DFT, namely N. I a signal [] conains DIUHTXHQF\Ȧ x which is no close o one o he requency values available in he DFT, he requency specrum will have o use a combinaion o he available requencies o subsiue, resuling in specral leakage. Thus when perorming a DFT in MATLAB i can be exremely helpul o know wha requency you are looking or, and adjus inpu parameers accordingly. Modern implemenaions o he DFT use an algorihm called he Fas Fourier Transorm, or FFT, and use clever windowing echniques o reduce he inheren problems o he DFT approximaions. Windowing reers o aking subses o he signal and perorming he FFT muliple imes you can see how his can aec your resul based again on he number N o requency values being he same as he number o ime values.
N ik 2 S n N ¹ > @ N n DFT: Hk [ ] hne, k,,..., N N ik 2 S n N ¹ hn H ke, n,,..., N DFT - : > @ > @ k Now le s look a a sampling example see nex documen, hand-wrien pages.