1 / 50

Ruihua Liu, Ph.d ., Temesguen Messay

MTH -343 Mathematics for Electrical and Computer Engineers MATLAB Project II The Discrete Fourier Transform. Ruihua Liu, Ph.d ., Temesguen Messay. University of Dayton - Department of Electrical and Computer Engineering - Spring 2009. Outline. Discussion about CTFT, DTFT and DFT/ fft

evers
Download Presentation

Ruihua Liu, Ph.d ., Temesguen Messay

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MTH -343 Mathematics for Electrical and Computer EngineersMATLAB Project IIThe Discrete Fourier Transform RuihuaLiu, Ph.d., TemesguenMessay University of Dayton - Department of Electrical and Computer Engineering - Spring 2009

  2. Outline • Discussion about CTFT, DTFT and DFT/fft • Section I (Mandatory 100pts) • The DFT/fft • Communication (Problem I) • Signal Processing (Problem II) • Discussion about CSFT, DSFT and 2-D DFT/fft2 • Section II ( Optional, Extra Credit 60pts) • The 2D-DFT FFT2 • Spatial Frequency Spectrum (Part a) • Image Processing (Part b) • Optical Engineering (Part c) • Z-Domain (part d) • History and functionality of the Fast Fourier Transform algorithm (part e)

  3. The Continuous Time Fourier Transform (CTFT) and its inverse transform (iCTFT) xc(t) • Continuous Time Fourier Transform (CTFT) • Analog frequencies • Ω in • F in • Inverse Continuous Time Fourier Transform (iCTFT)

  4. The notion of sampling/‘discretizing’ xc(t) • Let x(n) be a sampled version of the continuous-time signal xc(t), sampled at regular interval Ts: • Sampling period • Sampling frequency • We do so by multiplying xc(t) by an impulse train function, s(t) (Dirac Deltas) • Dirac Delta : s(t) xc(t)s(t)

  5. Discrete Time Fourier Transform (DTFT) • Nyquist criterion … A MUST !!!!! • The Nyquist–Shannon sampling theorem • The minimum sampling rate required to avoid aliasing, • Signal must be sampled twice the highest frequency contained within the signal. • From CTFT to Discrete Time Fourier Transform (DTFT)

  6. The DTFT and its periodicity • DTFT: Introducing/Switching to digital frequency ω • Digital frequencies: • in Note: • in • DTFT of x(n) (i.e., X(ω )) is continuous and 2π-periodic in frequency ω !!! • Inverse DTFT (iDTFT)

  7. DTFT periodicity • In digital frequencies • Spectrum of x(n) is periodic in w with period 2p. • Spectrum of x(n) is also periodic in f with unity period (i.e., 1 cycle/sample). • In analog frequencies • Spectrum of x(n) is periodic in W with period ( 2p ) / Ts. • Spectrum of x(n) is also periodic in F with period Fs. • Due to periodicity Xs(W) and Xs(w) are the summation of scaled and shifted copies of Xc(W), i.e. Xc(w) . • Mathematically; • Digital • Analog

  8. From DTFT to Discrete Fourier Transform (DFT) The DFT is the Fast Fourier Transform (fft)!! • The digital frequencies( ω and f ) are in turn discretizedin one period [0-2π and 0-1] by introducing k • DFT - Take transform of these discrete frequencies • Proper interpretation of the spacing of the DFT samples Digital (Normalized) Spacing Analog Spacing • Inverse DFT (iDFT) DFT Analog frequencies

  9. Interpretation of DFT Frequencies Hence, for an 8 point fft transform k = 0 1 2 3 4 5 6 7 Bin number Digital or Normalized frequency fk = Analogue frequency (Hz) Fk =

  10. Section IProblem I Communication • Amplitude Modulation (AM) • Simulating a primitive method of transmitting a signal

  11. Concept of Communication Systems The sound wave is equivalent to a pressure wave traveling through air A microphone converts the sound wave (pressure wave) into an electrical wave The electrical wave traveling through the microphone wire is analogous to the original sound wave A sound wave is produced (a disturbance travelling through a medium : air ) A radio contains an antenna to detect the transmitted signal, a tuner to pick out the desired frequency, a decoder to extract the original electrical wave from the transmitted signal and a speaker to reproduce the sound wave AM FM [Encoder/Converter] The electrical wave (signal) is used to convert (encode) the sound waves into high frequency waves in the radio frequency range (electromagnetic waves ) The signal is then transmitted by a radio broadcast tower or antenna

  12. Generating the message signal - m(t)

  13. Examining the FFT of the generated message signal (the frequency domain) – M(f)

  14. The carrier Signal Time Domain Frequency Domain

  15. Amplitude Modulation - Transmission Time Domain Frequency Domain ?

  16. Examining AM message signal spectrum using MATLAB built-in functions SPECTROGRAM(X,WINDOW,NOVERLAP,NFFT,Fs) PERIODOGRAM(X,WINDOW,NFFT,Fs)

  17. Section IProblem II Signal Processing • Designing and implementing a graphic equalizer • Frequency sampling design

  18. An audio signal (Sound wave) MATLAB = ‘fft())’ fs 0 • [ Y, FS ]=WAVREAD(FILE) • SOUND(Y,FS) • Y = Y( : , 1 ) ; (conversion from stereo to mono) MATLAB = ‘fftshift(fft())’ Time Domain Frequency Domain fs = 44.1KHz Ts = 1/fs (secs) -fs/2 fs/2 CD sampling rate = 44.1KHz

  19. Graphic Equalizer Bank of sliders for boosting and attenuating/cutting different bands (i.e., range of frequencies)

  20. Geq : 3 Filters Frequency Domain Ideal continuous Frequency Response of the filters • Woofer/sub-woofer (LPF) • ~ 0 – ~300 Hz (cut-off) • Mid-Range (BPF) • ~ 300Hz - ~5KHz • Tweeter (HPF) • ~ 5KHz – 22.05KHz fs/2 -fs/2 Note : frequency response in Hz → ‘Effective‘ cont frequency response

  21. Frequency Sampling filter designExample : Woofer ~ 0 - 300Hz (LPF) • N = 151 samples (filter length in freq. domain) • Samples of ideal cont. freq. resp. of filter for frequencies ranging from -fs/2 to fs/2 → from -22.05KHz to 22.05KHz • Frequency response is symmetric • 75 samples for positive frequencies • 75 samples for negative frequencies • 1 sample for f = 0 Hz ( DC value ) • Need to sample only half of ideal frequency response of LPF filter • Samples of continuous and ideal frequency response of filter for frequencies ≥0 Hz ( i.e., for positive frequencies & DC value) • ( N + 1) / 2 = 76 samples→ from 0 to 22.05KHz • Sampling Rate • fs / N = 290.13 Hz / sample • Take a sample every ~ 290 Hz (Total of 76 samples) (i.e., define array consisting of 76 ones and zeros representing samples every 290Hz of the ideal frequency response of filter starting from f = 0Hzup to f = 22.05KHz ) Note : Zoomed in

  22. Frequency Sampling filter designExample : Woofer ~ 0 - 300Hz (LPF) • Need to sample the other half of the cont. ideal frequency response (i.e., negative frequencies ) • Flip the samples of the ideal frequency response for the positive frequencies ( i.e., defined array consisting of 76 samples) starting from the 2nd sample → 75 samples for neg. freq range • Take conjugate • Concatenate the samples of both half responses (i.e., negative and positive frequencies respectively) • Result range: - fs/2 to fs/2 = -22.05KHz to 22.05KHz • Circularly shift result/samples • ifftshift() • Result range: 0 to 2π (rads/sample) • Result range: 0 to 44.1 (Khz) • Compatible with ‘ifft’

  23. Frequency Sampling filter designExample : Woofer ~ 0 - 300Hz (LPF) fftshift(ifft()) • Inverse Fourier Transform (ifft)to get samples of the Impulse Responseof filter in time domain. • Check actual, effective and continuous frequency response of filter (High resolution transform, N =1024) fftshift(fft())

  24. Effective frequency responses of the three filters Frequency Domain Time Domain fftshift(fft()) fftshift(fft()) fftshift(fft())

  25. Combining the filters in the time domain using the specified weights to get impulse response of Geq Ideal Goal in Frequency Domain • Woofer/sub-woofer (LPF) • W1 = 1/4 • Mid-Range (BPF) • W2 = 1/2 • Tweeter (HPF) • W3 = 1 Time Domain h_LPF W1 h_Eq ∑ h_BPF W2 h_HPF W3

  26. Implementing graphic Eq Frequency Domain Time Domain fftshift(fft()) ? CONV fftshift(fft()) Note: use conv2(‘same’)

  27. Operational Fourier Properties (p251) *Convolution :

  28. Section II (2-D DFT) • Discussion about 2-D DFT/fft2 • Section II ( Optional, Extra Credit 60pts) • The 2D-DFT FFT2 • Spatial Frequency Spectrum (Part a) • Image Processing (Part b) • Optical Engineering (Part c) • Z-Domain (part d) • History and functionality of the Fast Fourier Transform algorithm (part e)

  29. Continuous Space Fourier Transform (CSFT) • Forward • Reverse • Units (continuous) • x, y: spatial position (in mm) • U, V: spatial frequency (in cycles/mm) f(x, y) F(U, V)

  30. Discrete Space Fourier Transform (DSFT) • Forward • Reverse • Forward • Reverse nx,nydiscrete in sample #, u,vcontinuous in cycles/sample (repeats period 1) nx,nydiscrete in sample #, ωx, ωycontinuous in rads/sample (repeats period 2π)

  31. 2-D DFT ( = fft2) • Discretized/normalized (Digital) spatial frequencies: • Forward • Reverse • FYI : KEY • u,v in cycles/sample • Divide by pixel spacing to get U,V in cycles/mm

  32. 2-D circular shift (fftshift)

  33. Generating images ( Vertical and Horizontal strips) • Repeat/Duplicate the message and carrier signals (i.e., arrays) in problem I horizontally and vertically to form matrices (i.e., images) • Use 129 samples instead of the original 201 • Use‘repmat()’to duplicate the signals 129 times in the desired orientation. • Use‘imagesc()’followed by ‘colormap(gray)’ to display image Spatial Domain Images (High intensity variation) Images (slow intensity variation)

  34. Spatial frequency spectrum (fft2) Spatial frequency Domain Fourier Domain fftshift(fft2()) Spatial Domain

  35. Reading a ‘Natural’ Image

  36. Analyzing spatial frequency spectrum of ‘natural’ image Spatial frequency Domain Fourier Domain Spatial Domain Note : - Convert to double() before fft2() - Magnitude is clipped @10,000 to obtain a decent plot

  37. 2-D Low pass spatial filter Spatial frequency Domain Fourier Domain Spatial Domain fftshift(fft2())

  38. 2-D convolution • Continuous extension • Discrete extension

  39. Implement 2-D low pass filter Spatial Domain CONV2() Spatial frequency Domain Fourier Domain

  40. 2-D High Pass spatial filterusing fspecial(‘unsharp’) Spatial frequency Domain Fourier Domain Spatial Domain fftshift(fft2()) Note : Not entirely true

  41. Implement 2-D High pass filter Spatial Domain CONV2() Spatial frequency Domain Fourier Domain

  42. 2-D motion blur filterusing fspecial(‘motion’) Spatial frequency Domain Fourier Domain Spatial Domain fftshift(fft2())

  43. Implement 2-D motion blur filter Spatial Domain CONV2() Spatial frequency Domain Fourier Domain

  44. Diffraction Pattern (Fresnel / Fraunhofer approximation) After several computational derivation steps ...

  45. Diffraction pattern simulation in MATLAB fftshift(fft2()) Note: true image

  46. Magnitude surface plot of a complex function f(z) Given function: where

  47. Magnitude of unit circle overlaid on magnitude surface plot

  48. Phase angle of unit circle overlaid on Phase angle surface plot

More Related