Fast Fourier Transform and MATLAB Implementation



Similar documents
Cooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley

Escola Federal de Engenharia de Itajubá

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE The absolute value of the complex number z a bi is

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 8

Normal Distribution.

3. Greatest Common Divisor - Least Common Multiple

Basic Measurement Issues. Sampling Theory and Analog-to-Digital Conversion

CHAPTER 3 DIGITAL CODING OF SIGNALS

Theorems About Power Series

FOUNDATIONS OF MATHEMATICS AND PRE-CALCULUS GRADE 10

APPLICATION NOTE 30 DFT or FFT? A Comparison of Fourier Transform Techniques

3. If x and y are real numbers, what is the simplified radical form

Heat (or Diffusion) equation in 1D*

Math 114- Intermediate Algebra Integral Exponents & Fractional Exponents (10 )

Soving Recurrence Relations

Incremental calculation of weighted mean and variance

MATH 083 Final Exam Review

Overview of some probability distributions.

Complex Numbers. where x represents a root of Equation 1. Note that the ± sign tells us that quadratic equations will have

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).

Properties of MLE: consistency, asymptotic normality. Fisher information.

SAMPLE QUESTIONS FOR FINAL EXAM. (1) (2) (3) (4) Find the following using the definition of the Riemann integral: (2x + 1)dx

Sequences and Series

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction

Section 11.3: The Integral Test

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008

A probabilistic proof of a binomial identity

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method

GCSE STATISTICS. 4) How to calculate the range: The difference between the biggest number and the smallest number.

WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER?

I. Chi-squared Distributions

Convention Paper 6764

Now here is the important step

Confidence Intervals for One Mean

2-3 The Remainder and Factor Theorems

Domain 1 - Describe Cisco VoIP Implementations

CHAPTER 3 THE TIME VALUE OF MONEY



Modified Line Search Method for Global Optimization

Cantilever Beam Experiment

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Lecture 5: Span, linear independence, bases, and dimension

Lesson 15 ANOVA (analysis of variance)

Engineering Data Management

S. Tanny MAT 344 Spring be the minimum number of moves required.

Our aim is to show that under reasonable assumptions a given 2π-periodic function f can be represented as convergent series

How To Solve The Homewor Problem Beautifully

Maximum Likelihood Estimators.

NATIONAL SENIOR CERTIFICATE GRADE 12

Class Meeting # 16: The Fourier Transform on R n

Department of Computer Science, University of Otago

*The most important feature of MRP as compared with ordinary inventory control analysis is its time phasing feature.

Repeating Decimals are decimal numbers that have number(s) after the decimal point that repeat in a pattern.

Fast Fourier Transform

A Theoretical and Experimental Analysis of the Acoustic Guitar. Eric Battenberg ME

CHAPTER 7: Central Limit Theorem: CLT for Averages (Means)

Solving Logarithms and Exponential Equations

4.3. The Integral and Comparison Tests

Biology 171L Environment and Ecology Lab Lab 2: Descriptive Statistics, Presenting Data and Graphing Relationships

GCE Further Mathematics (6360) Further Pure Unit 2 (MFP2) Textbook. Version: 1.4

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

1 Correlation and Regression Analysis

Multiplexers and Demultiplexers

Definition. A variable X that takes on values X 1, X 2, X 3,...X k with respective frequencies f 1, f 2, f 3,...f k has mean

1 Computing the Standard Deviation of Sample Means

where: T = number of years of cash flow in investment's life n = the year in which the cash flow X n i = IRR = the internal rate of return

Your organization has a Class B IP address of Before you implement subnetting, the Network ID and Host ID are divided as follows:

Case Study. Normal and t Distributions. Density Plot. Normal Distributions

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n

Infinite Sequences and Series

Taking DCOP to the Real World: Efficient Complete Solutions for Distributed Multi-Event Scheduling

CS100: Introduction to Computer Science

Approximating Area under a curve with rectangles. To find the area under a curve we approximate the area using rectangles and then use limits to find

Confidence Intervals. CI for a population mean (σ is known and n > 30 or the variable is normally distributed in the.

Overview on S-Box Design Principles

Convexity, Inequalities, and Norms

CS103X: Discrete Structures Homework 4 Solutions

Solutions to Selected Problems In: Pattern Classification by Duda, Hart, Stork

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis

Chapter 5: Inner Product Spaces

A Combined Continuous/Binary Genetic Algorithm for Microstrip Antenna Design

Basic Elements of Arithmetic Sequences and Series

Listing terms of a finite sequence List all of the terms of each finite sequence. a) a n n 2 for 1 n 5 1 b) a n for 1 n 4 n 2

The Stable Marriage Problem

Building Blocks Problem Related to Harmonic Series

On Formula to Compute Primes. and the n th Prime

Problem Solving with Mathematical Software Packages 1

1. MATHEMATICAL INDUCTION

MATHEMATICS P1 COMMON TEST JUNE 2014 NATIONAL SENIOR CERTIFICATE GRADE 12

Study on the application of the software phase-locked loop in tracking and filtering of pulse signal

1 The Gaussian channel

Measures of Spread and Boxplots Discrete Math, Section 9.4

MEI Structured Mathematics. Module Summary Sheets. Statistics 2 (Version B: reference to new book)

All Digital Timing Recovery and FPGA Implementation

Hypothesis testing. Null and alternative hypotheses

5: Introduction to Estimation

NEW HIGH PERFORMANCE COMPUTATIONAL METHODS FOR MORTGAGES AND ANNUITIES. Yuri Shestopaloff,

Transcription:

Fast Fourier Trasform ad MATLAB Implemetatio by aju Huag for Dr. Duca L. MacFarlae

Sigals I the fields of commuicatios, sigal processig, ad i electrical egieerig moregeerally, a sigalisay time varyig or spatial varyig quatity This variable(quatity chages i time Speech or audio sigal: A soud amplitude that varies i time Temperature readigs at differet hours of a day Stock price chages over days Etc. Sigals ca be classified by cotiues time sigal ad discrete time sigal: A discrete sigal or discrete time sigal is a time series, perhaps a sigal that has bee sampled ldfrom a cotiuous time sigal A digital sigal is a discrete time sigal that takes o oly a discrete set of values Cotiuous Time Sigal Discrete Time Sigal.5.5 f(t f[] -.5 -.5-3 4 Time (sec - 3 4

Periodic Sigal periodic sigal ad o periodic sigal: Periodic Sigal o-periodic Sigal f(t f[] - 3 4 Time (sec Period T: The miimum iterval o which a sigal repeats Fudametal frequecy: f =/T - 3 4 Harmoic frequecies: kf Ay periodic sigal ca be approimated by a sum of may siusoids at harmoic frequecies of the sigal(kf f with appropriate amplitude ad phase Istead of usig siusoid sigals, mathematically, we ca use the comple epoetial fuctios with both positive ad egative harmoic frequecies Euler formula: ep( j t si( t j cos( t 3

Time Frequecy Aalysis A sigal has oe or more frequecies i it, ad ca be viewed from two differet stadpoits: Time domai ad Frequecy domai Time Domia (Baded re Sog Frequecy Domai Amplitude Power - 4 6 8 Sample umber 4 4 6 8 Frequecy (Hz Time domaifigure: how asigalchages g over time Frequecy domai figure: how much of the sigal lies withi each give frequecy bad over a rage of frequecies hy frequecy domai aalysis? To decompose a comple sigal ito simpler parts to facilitate aalysis Differetial ad differece equatios ad covolutio operatios i the time domai become algebraic operatios i the frequecy domai Fast Algorithm (FFT 4

Fourier Trasform e ca go betwee the time domai ad the frequecy domai by usig a tool called Fourier trasform A Fourier trasform coverts a sigal i the time domai to the frequecy domai(spectrum A iverse Fourier trasform coverts the frequecy domai compoets back ito the origial time domai sigal Cotiuous Time Fourier Trasform: F ( j f ( t e j t dt f ( t Discrete Time Fourier Trasform(DTFT: X ( e j [ ] e j F ( j e j t d j j [ ] X ( e e d 5

Fourier Represetatio For Four Types of Sigals The sigal with differet time domai characteristics has differet frequecy domai characteristics Cotiues time periodic sigal > discrete o periodic spectrum Cotiues time o periodic sigal > cotiues o periodic spectrum 3 Discrete o periodic sigal > > cotiues periodicspectrum 4 Discrete periodic sigal > discrete periodic spectrum The last trasformatio betwee time domai ad frequecy is most useful The reaso that discrete is associated with both time domai ad frequecy domai is because computers ca oly take fiite discrete time sigals 6

( ( k Periodic Sequece A periodic sequece with period is defied as: For eample: k e j k, where k is iteger (it is called Twiddle Factor k ( k k ( Properties: Periodic k k * ( k k ( Symmetric ( Orthogoal k k r other For a periodic sequece ( with period, oly samples are idepedet. So that sample i oe period is eough to represet the whole sequece 7

Amplitude Discrete Fourier Series(DFS Periodic sigals may be epaded ito a series of sie ad cosie fuctios X ( k X ( k ( ( k X ( k k X ( k DFS ( IDFS ( ( ( X ( k is still a periodic sequece with period i frequecy domai The Fourier series forthe discrete time periodic wave show below:.5 Sequece (i time domai 3 4 time X. -. Fourier Coeffiets -.4 4 3 4 8

Fiite Legth Sequece Real lift sigal is geerally a fiitei legth sequece ( ( others If we periodic eted it by the period, the ( ( r ( r ( 9

Relatioship Betwee Fiite Legth Sequece ad Periodic Sequece A periodic sequece is the periodic etesio of a fiite legth sequece ( ( r (( m A fiite legth sequece is the pricipal value iterval of the periodic sequece ( ( R ( here R ( others So that: ( ( R ( IDFS [ X ( k ] R ( X ( k X ( k R ( k DFS[ ( ] R (

Discrete Fourier Trasform(DFT Usig the Fourier series represetatio we have Discrete Fourier Trasform(DFT for fiite legth sigal DFT ca covert time domai discrete sigal ito frequecydomai discrete spectrum Assume that we have a sigal { [ ]}. The the DFT of the sigal is a sequece X [ k ] for k,, X [ k ] [ ] e jk The Iverse Discrete Fourier Trasform(IDFT: [ ] k X [ k ] e jk / /,,,,. ote that because MATLAB caot use a zero or egative idices, the ide starts from i MATLAB

DFT Eample The DFT is widely used i the fields of spectral aalysis, acoustics, medical imagig, ad telecommuicatios. For eample: [ ] [ 4 6 ], 4, ( 3 j k,,,3 X [ k ] [ ] e [ ]( j X [ ] 4 ( 6 X [ ] ( 4 j 6 j 3 3 X [ ] ( 4 ( 6 9 X [ 3] ( 4 j 6 j 3 j k j Amplitude X[k] 6 5 4 3 Time domai sigal -.5.5.5 3 Time 8 6 4 Frequecy domai sigal.5.5.5 3 Frequecy

Fast Fourier Trasform(FFT The Fast Fourier Trasform does ot refer to a ew or differet type of Fourier trasform. It refers to a very efficiet algorithm for computig the DFT The time take to evaluate a DFT o a computer depeds pricipally o the umber of multiplicatios ivolved. DFT eeds multiplicatios. FFT oly eeds log ( The cetral isight which leads to this algorithm is the realizatio that a discrete Fourier trasform of a sequece of poits ca be writte i terms of two discrete Fourier trasforms of legth / Thus if is a power of two, it is possible to recursively apply this decompositio util we are left with discrete Fourier trasforms of sigle poits 3

Fast Fourier Trasform(cot. Fast Fourier Trasform(cot. Re writig / ] [ ] [ jk e k X as ] [ ] [ k k X It is easy to realize that the same values of are calculated may times as the k It is easy to realize that the same values of are calculated may times as the computatio proceeds Usig the symmetric property of the twiddle factor, we ca save lots of computatios ( ( ( ( ] [ ] [ ( r r k X r k kr odd k eve k k ( ( ( ( ( ( k X k X r r r r k r kr k r kr r r ( ( k X k X k Thus the poit DFT ca be obtaied from two / poit trasforms, oe o eve iput data, ad oe o odd iput data. 4

Itroductio for MATLAB MATLAB is a umerical computig eviromet developed by Mathorks. MATLAB allows matri maipulatios, plottig of fuctios ad data, ad implemetatio of algorithms Gettig help You ca get help by typig the commads help or lookfor at the >> prompt, e.g. >> help fft Arithmetic operators Symbol Operatio Eample + Additio 3. + 9 Subtractio 6. 5 * Multiplicatio * 3 / Divisio 5 / ^ Power 3^ 5

Data Represetatios i MATLAB Variables: Variablesaredefiedastheassigmetoperator =.Thesytaof variable assigmet is variable ame = a value (or a epressio For eample, >> = 5 = 5 >> y = [3*7, pi/3]; % pi is i MATLAB Vectors/Matrices: MATLAB ca create ad maipulate arrays of (ectors (vectors, (matrices, or more dimesios row vectors: a = [,, 3, 4] is a X4 matri colum vectors: b = [5; 6; 7; 8; 9] is a 5X matri, e.g. >> A = [ 3; 7 8 9; 4 5 6] A = 3 7 8 9 4 5 6 6

Mathematical Fuctios i MATLAB MATLAB offers may predefied mathematical fuctios for techical computig, e.g. cos( Cosie abs( Absolute value si( Sie agle( Phase agle ep( Epoetial coj( Comple cojugate sqrt( Square root log( atural logarithm Colo operator (: Suppose we wat to eter a vector cosistig of poits (,.,.,.3,,5. e ca use the commad >> = :.:5; Most of the work you will do i MATLAB will be stored i files called scripts, orm files, cotaiig sequeces of MATLAB commads to be eecuted over ad over agai 7

Basic plottig i MATLAB MATLAB has a ecellet set of graphic tools. Plottig a give data set or the results of computatio is possible with very few commads The MATLAB commad to plot a graph is plot(,y, e.g. >> = :pi/:*pi; p.8 >> y = si(;.6 >> plot(,y.4 Sie fuctio MATLAB eables you to add ais Labels ad titles, e.g. Sie of. -. -.4 >> label('=:\pi'; -.6 >> ylabel('sie of '; -.8 >> tile('sie fuctio' - 3 4 5 6 7 =: 8

Amplitude Power.5 -.5 Sie ave Sigal -..4.6.8 Time (s 8 6 4 Power Spectrum of a Sie ave 3 4 5 6 7 8 Frequecy (Hz Eample : Sie ave Fs = 5; % Samplig frequecy t = :/Fs:; % Time vector of secod f = 5; % Create a sie wave of f Hz. = si(*pi*t*f; i*t*f fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % Frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('sie ave Sigal'; label('time (s'; ylabel('amplitude'; l('a lit ' figure(; plot(f,m; title('power Spectrum of a Sie ave'; label('frequecy (Hz'; ylabel('power'; Frequecy (Hz ylabel( Power ; 9

Eample : Cosie ave Amplitude Power.5 -.5 Cosie ave Sigal -..4.6.8 Time (s 8 6 4 Power Spectrum of a Cosie ave 3 4 5 6 7 8 Frequecy (Hz Fs = 5; % Samplig frequecy t = :/Fs:; % Time vector of secod f = 5; % Create a sie wave of f Hz. = cos(*pi*t*f; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % Frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('sie ave Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of a Sie ave'; label('frequecy (Hz'; ylabel('power';

Eample 3: Cosie ave with Phase Shift Amplitude Power.5 -.5 Cosie ave Sigal with Phase Shift -..4.6.8 Time (s Power Spectrum of a Cosie ave Sigal with Phase Shift 8 6 4 3 4 5 6 7 8 Frequecy (Hz Fs = 5; % Samplig frequecy t = :/Fs:; % Time vector of secod f = 5; % Create a sie wave of f Hz. pha = /3*pi; % phase shift = cos(*pi*t*f + pha; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % Frequecy vector f = (:fft/-*fs/fft; / % Geerate the plot, title ad labels. figure(; plot(t,; title('sie ave Sigal'; label('time (s';; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of a Sie ave'; label('frequecy (Hz'; ylabel('power';

Eample 4: Squareave Amplitude Power.5 -.5 Square ave Sigal -..4.6.8 Time (s 8 6 4 Power Spectrum of a Square ave 4 6 8 Frequecy (Hz Fs = 5; % Samplig frequecy t = :/Fs:; % Time vector of secod f = 5; % Create a sie wave of f Hz. = square(*pi*t*f; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % Frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('square ave Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of a Square ave'; label('frequecy (Hz'; ylabel('power';

Eample 5: SquarePulse Amplitude Power.8.6.4. Square Pulse Sigal -.5.5 Time (s 3 5 5 5 Power Spectrum of a Square Pulse 4 6 8 Frequecy (Hz Fs = 5; % Samplig frequecy t = -.5:/Fs:.5; % Time vector of secod w =.; % width of rectagle = rectpuls(t, w; % Geerate Square Pulse fft = 5; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % Frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('square Pulse Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of a Square Pulse'; label('frequecy (Hz'; ylabel('power'; 3

Amplitude r Power 4 3 Gaussia Pulse Sigal -.5.5 Time (s 6 5 4 3 Eample 6: Gaussia Pulse Power Spectrum of a Gaussia Pulse 5 5 5 3 Frequecy (Hz Fs = 6; % Samplig frequecy t = -.5:/Fs:.5; = /(sqrt(*pi*.*(ep(-t.^/(*.; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % This is a evely spaced frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('gaussia Pulse Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of a Gaussia Pulse'; label('frequecy (Hz'; ylabel('power'; 4

Eample 7: Epoetial Decay Amplitude Powe er.5.5 7 6 5 4 3 Epoetial Decay Sigal..4.6.8 Time (s Power Spectrum of Epoetial Decay Sigal 4 6 8 Frequecy (Hz Fs = 5; % Samplig frequecy t = :/Fs:; % Time vector of secod = *ep(-5*t; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % This is a evely spaced frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('epoetial Decay Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of Epoetial Decay Sigal'; label('frequecy (Hz'; ylabel('power'; 5

Eample 8: Chirp Sigal Amplitude Pow wer.5 -.5 Chirp Sigal -..4.6.8 Time (s 5 5 5 Power Spectrum of Chirp Sigal 4 6 8 Frequecy (Hz Fs = ; % Samplig frequecy t = :/Fs:; % Time vector of secod = chirp(t,,,fs/6; fft = 4; % Legth of FFT % Take fft, paddig with zeros so that legth(x is equal to fft X = fft(,fft; % FFT is symmetric, throw away secod half X = X(:fft/; % Take the magitude of fft of m = abs(x; % This is a evely spaced frequecy vector f = (:fft/-*fs/fft; % Geerate the plot, title ad labels. figure(; plot(t,; title('chirp Sigal'; label('time (s'; ylabel('amplitude'; figure(; plot(f,m; title('power Spectrum of Chirp Sigal'; label('frequecy (Hz'; ylabel('power'; 6