Lecture 6

  • Uploaded by: Anonymous XR7iq7
  • 0
  • 0
  • February 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lecture 6 as PDF for free.

More details

  • Words: 3,187
  • Pages: 34
Loading documents preview...
Lectures 6-7 Representation of Signals in Frequency Domain

© 2010, All Rights Reserved, Robi Polikar. No part of this presentation may be used without explicit written permission. Such permission will be given – upon request – for noncommercial educational purposes only. Limited permission is hereby granted, however, to post or distribute this presentation if you agree to all of the following:

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

1. you do so for noncommercial educational purposes; 2. the entire presentation is kept together as a whole, including this entire notice. 3. you include the following link/reference on your site: Robi Polikar, http://engineering.rowan.edu/~polikar.

This Week in DSP  Representation of Signals in Frequency Domain  A preview  Fourier series  Continuous time Fourier transform  Discrete time Fourier transform  Discrete Fourier transform  Fast Fourier transform

RP

Robi Polikar – All Rights Reserved © 2004 – 2010.

 Fourier Series  Frequency domain representation of periodic signals  Trigonometric and complex representations of Fourier series

 Fourier Transforms  Frequency domain representations of aperiodic continuous time signals  Properties of Fourier transforms  Some common Fourier transform pairs Digital Signal Processing, © 2010 Robi Polikar, Rowan University

The Frequency Domain  Time domain operation are often not very informative and/or efficient in signal processing  An alternative representation and characterization of signals and systems can be made in transform domain  Much more can be said, much more information can be extracted from a signal in the transform / frequency domain.  Many operations that are complicated in time domain become rather simple algebraic expressions in transform domain  Most signal processing algorithms and operations become more intuitive in frequency domain, once the basic concepts of the frequency domain are understood.

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Frequency Domain An Example t=-1:0.001:1; x=sin(2*pi*50*t); subplot(211) plot(t(1001:1200),x(1:200)) 1 grid title('Sin(2\pi50t)') 0.5 xlabel('Time, s') subplot(212) 0 X=abs(fft(x)); -0.5 X2=fftshift(X); f=-499.9:1000/2001:500; -1 plot(f,X2); 0 0.02 grid title(' Frequency domain representation of Sin(2\pi50t)') xlabel('Frequency, Hz.')

Sin(250t)

0.04

0.06

0.08

0.1 0.12 0.14 0.16 Time, s Frequency domain representation of Sin(250t)

0.18

0.2

1000

500

RP 0 -500

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

-400

-300

-200

-100 0 100 Frequency, Hz.

200

300

400

500

Frequency Domain Another Example t=-1:0.001:1; x=sin(2*pi*50*t)+sin(2*pi*75*t); 2 subplot(211) plot(t(1001:1200),x(1:200)) 1 grid title('Sin(2\pi50t)+Sin(2\pi75t)') 0 xlabel('Time, s') subplot(212) -1 X=abs(fft(x)); X2=fftshift(X); f=-499.9:1000/2001:500; -2 0 plot(f,X2); grid title(' Frequency domain representation of Sin(2\pi50t)+Sin(2\pi75t)') 1000 xlabel('Frequency, Hz.')

Sin(250t)+Sin(275t)

0.02

0.04

0.06

0.08

0.1 0.12 0.14 0.16 0.18 Time, s Frequency domain representation of Sin(250t)+Sin(275t)

0.2

500

RP 0 -500

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

-400

-300

-200

-100 0 100 Frequency, Hz.

200

300

400

500

Frequency Domain And…Another Example Freq_domain_example.m

Sin(2 20t)+4Cos(2 50t)+2Sin(2 100t)

t=-1:0.001:1; x=sin(2*pi*20*t)+4*cos(2*pi*50*t)+2*sin(2*pi*100*t);

10

5

subplot(211) plot(t(1001:1200),x(1:200)) grid

0

-5

title('Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)') xlabel('Time, s')

-10

0

0.02

0.04

0.06

0.08

0.1 Time, s

0.12

0.14

0.16

0.18

0.2

subplot(212) X=abs(fft(x));

Frequency domain representation of Sin(220t)+4Cos(250t)+2Sin(2100t) 4000

X2=fftshift(X); f=-499.9:1000/2001:500; plot(f,X2);

3000

2000

grid title(' Frequency domain representation of Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)') xlabel('Frequency, Hz.')

1000

RP 0 -500

-400

-300

-200

-100

Magnitude spectrum Digital Signal Processing, © 2010 Robi Polikar, Rowan University

0 100 Frequency, Hz.

200

300

400

500

The Fourier Transform

Spectrum: A compact representation of the frequency content of a signal that is composed of sinusoids

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Fourier Who…?

“An arbitrary function, continuous or with discontinuities, defined in a finite interval by an arbitrarily capricious graph can always be expressed as a sum of sinusoids” J.B.J. Fourier December 21, 1807

Jean B. Joseph Fourier (1768-1830) F [k ]   f (t )e

 j 2kt / N

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

dt

1 N 1 f (t )  F [k ]e j 2kt / N  2 i 0

Jean B. J. Fourier  He announced his discovery in a prize paper on the theory of heat (1807).  The judges: Laplace, Lagrange, Poisson and Legendre

 Three of the judges found it incredible that sum of sines and cosines could add up to anything but an infinitely differential function, but...  Lagrange: Lack of mathematical rigor and generality Denied publication…. • • • •

Became famous with his other previous work on math, assigned as chair of Ecole Polytechnique Napoleon took him along to conquer Egypt Return back after several years Barely escaped Giyotin!

 After 15 years, following several attempts and disappointments and frustration, he published his results in Theorie Analytique de la Chaleur in 1822 (Analytical Theory of Heat).  In 1829, Dirichlet proved Fourier’s claim with very few and non-restricting conditions.

 Next 150 years: His ideas expanded and generalized. 1965: Cooley and Tukey--> Fast Fourier Transform  Computational simplicity  King of all transforms… Countless number of applications engineering, finance, applied mathematics, etc. Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Fourier Transforms  Fourier Series (FS)  Fourier’s original work: A periodic function can be represented as a finite, weighted sum of sinusoids that are integer multiples of the fundamental frequency Ω0 of the signal.  These frequencies are said to be harmonically related, or simply harmonics.

 (Continuous) Fourier Transform (FT)  Extension of Fourier series to non-periodic functions: Any continuous aperiodic function can be represented as an infinite sum (integral) of sinusoids. The sinusoids are no longer integer multiples of a specific frequency anymore.

 Discrete Time Fourier Transform (DTFT)  Extension of FT to discrete sequences. Any discrete function can also be represented as an infinite sum (integral) of sinusoids.

 Discrete Fourier Transform (DFT)  Because DTFT is defined as an infinite sum, the frequency representation is not discrete (but continuous). An extension to DTFT is DFT, where the frequency variable is also discretized.

 Fast Fourier Transform (FFT)  Mathematically identical to DFT, however a significantly more efficient implementation. FFT is what signal processing made possible today! Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Dirichlet Conditions (1829)  For which type of functions, can Fourier transform be calculated?  Dirichlet put the final period to the discussion on the feasibility of Fourier transform by proving the necessary conditions for the existence of Fourier representations of signals  The signal must have finite number of discontinuities  The signal must have finite number of extremum points within its period  The signal must be absolutely integrable within its period t0 T

 x(t ) dt  

t0

 How restrictive are these conditions…?

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

A Demo In Simulink Fourier_spectrum

DSP [512x1]

|FFT|

[512x1]

2

[512x1] [512x1]

Magnitude FFT

Sine Wave

[512x1]

Freq Vector Scope

Time Vector Scope1

OR DSP [512x1] [512x1]

Sine Wave1

FFT Spectrum Scope

[512x1]

Time Vector Scope3

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

RP

Simulink Run

Original signal, f=25Hz, Frame size=512 Sampling time=1/1000s Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Corresponding spectrum

RP

Another Simulink Demo Sample_vs_frame_spectrum

Sample based vs. Frame based Calculation DSP

Sine Wave2 DSP

Add

Sine Wave3

FFT

|u|

FFT

Abs

Freq Direct Spectrum Scope2

DSP FFT Sine Wave4

FFT Spectrum Scope2

Sine Wave5

Sine Wave6

Add1

Buffer

Sine Wave7

|u|

FFT1

Abs1

FFT

Sample Based Time Scope

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

FFT

FFT Spectrum Scope3

Freq Direct Spectrum Scope 3

RP

Fourier Series  Any periodic signal x(t) whose fundamental period is T0 (hence, fundamental frequency f0=1/T0, Ω0=2πf0), can be represented as a finite sum of complex exponentials (sines and cosines)  That is, a signal however arbitrary and complicated it may be, can be represented as a sum of simple building blocks 

x(t )   ck e j0kt k  

 Note that each complex exponential that makes up the sum is an integer multiple of Ω0, the fundamental frequency  Hence, the complex exponentials are harmonically related  The coefficients ck , aka Fourier (series) coefficients, are possibly complex • Fourier series (and all other types of Fourier transforms) are complex valued ! That is, there is a magnitude and phase (angle) term to the Fourier transform!

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Fourier Series  This is the synthesis equation: x(t) is synthesized from its building blocks, the complex exponentials at integer multiples of Ω0 

x(t )   ck e jk0t k  

kΩ0: “kth” integer multiple – kth harmonic of the fundamental frequency ck: Fourier coefficients – how much of kth harmonic exists in the signal |ck|: Magnitude of the kth harmonic  magnitude spectrum of x( t ) < ck: Phase of the

kth harmonic

 phase spectrum of x( t )

 How to compute the Fourier coefficients, ck?

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

0

Spectrum of x(t)

Fourier Series  The coefficients ck can be obtained through the analysis equation.

1 t0 T0  jk0t ck  x ( t ) e dt  T0 t0

The limits of the integral can be chosen to cover any interval of T0, for example, [-T0/2 T0/2] or [0 T0] or [-T0 0].

 Note that, while x(t) is a sum, ck are obtained through an integral of complex values.  Why / how…?

 More importantly, if x(t) is real, then the coefficients satisfy c-k=c*k, that is |c-k|=|ck|  why?

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Trigonometric Fourier Series  Using the Euler’s rule, we can represent the complex Fourier series in two trigonometric forms: x(t )  a0  ak 



 ak cosk0t   bk sin k0t 

k 1

2 x(t ) cos k0t dt  T0 T 0

bk 

2 x(t ) sin k 0t dt T0 T 0

 As you might have already guessed, the trigonometric Fourier coefficients, ak and bk, are not independent of the complex Fourier coefficients a0  2c0 ak  ck  ck bk  j ck  ck  a  jbk ck  k , 2 Digital Signal Processing, © 2010 Robi Polikar, Rowan University

a  jbk c k  k 2

Quick Facts and An Example  Fourier series are computed for periodic signals (continuous or discrete) only! A periodic signal has finite number of discrete spectral components.  Each spectral component is represented by ck and c-k Fourier series coefficients, k=1,2,…,N.  Each k represents one of the spectral components at integer multiples of Ω0, the fundamental frequency of the signal. These discrete spectral components at Ω0, 2Ω0,…, NΩ0 are called harmonics. • For example, the signal x(t)=cos4πt+sin6πt has two (four, if you count the negative frequencies) spectral components. The fundamental frequency is Ω0=2π, and c-3=-1/2j, c3=1/2j, c-2=c2=1/2

ck 1/2

-3

j/2

1/2

-2 -1 -j/2

0

1

k=0 Ω=0 rad/s k=1 Ω=2π rad/s k=2 Ω=4π rad/s k=3 Ω=6π rad/s

2

3

k

1 j 4 t  j 4 t 1 e e   e j 6 t  e  j 6 t    2 2j Why? 1 1 1 1  e j 22 t  e j 22 t  e j 32 t  e j 32 t 2 2 2j 2j

cos  4 t   sin  6 t  

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Another Example x  t   cos  4 t   2cos 16 t  Original Signal 5

t=0:0.001:0.5; x=cos(2*pi*2*t)+2*cos(2*pi*8*t); w0=2*pi*2; K=5; [X x_recon]=fourier_series(x,K,t,w0);

0 -5

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

3

4

5

Fourier Series Magnitude Coefficients 4 2 0 -5

-4

-3

-2

-1

0

1

2

Reconstructed Signal 10 p.s. fourier_series() is not a standard Matlab function. You will be writing this function as part of next lab.

0

RP -10

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

Fourier Series Demo  http://homepages.gac.edu/~huber/fourier/

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Quick Facts About Fourier Series  If a signal is even, then all bk=0, and if a signal is odd, then all ak=0  If x(t) is real, then the Fourier series are symmetric, that is, ck=c-k  This is inline with our interpretation of frequency as two phasors rotating at the same rate but opposite directions.  For real signals, the relationship between complex and trigonometric representation of Fourier series further simplifies to ak  2ck  bk  2 Im[ck ]  We also have a third representation for real signals: kth harmonic

x(t )  C0 



 Ck cosk0t   k 

k 1

a b C0  0 , Ck  ak2  bk2 ,  k  tan 1 k 2 ak Phase angles DC component Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Harmonic amplitudes

Fourier Series Summary  We can often tell much more about a signal by looking at its frequency content, that is, its spectrum.  For continuous time signals, that are also periodic with a fundamental frequency of Ω0, Fourier series gives us the spectrum of the signal  The Fourier series of such a signal is a series of impulses at integer multiples of Ω0. These impulses in the frequency domain represent the harmonics of the signal  Remember: the term ejΩo represents one spectral component at frequency Ω0  Cos(Ω0t) has two such complex exponentials in it, at ±Ω0. Therefore, each cosine at a particular frequency Ω0 consists of two spectral components, one at each of ±Ω0. e j o t  e  j o t Cos  0t   2 e j o t  e  j o t Sin  0t   2 j

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

The Fourier Transform  Fourier series are defined only on periodic signals. Non-periodic continuous time signals can also be represented as a sum of weighted complex exponentials; however  The complex exponentials are no longer discrete and integer multiples of a fundamental frequency.  Unlike the FS, where we represented the signal with a finite sum of harmonics, for non-periodic signals, we need a sum (integration) of continuum of frequencies.  The continuous Fourier transform (FT), can be obtained from the FS representation of a signal, by assuming that the non-periodic signal is periodic with an infinite period. This results in: X       x(t )  



 x(t )e

 jt

dt





1 x(t )    X ()   2 1

Digital Signal Processing, © 2010 Robi Polikar, Rowan University



 X ()e



jt

d

x(t )  x

Quick Facts About Fourier Transform  The FT, X(Ω) is a complex transform Magnitude Spectrum

Fourier Spectrum

Phase Spectrum

X    X   X    X   e j  

 If x(t) is real

Frequency dependent phase 1 X     2



 x(t )e

jt

dt  X    

X    X  ,      



 then, FT is conjugate symmetric !

(just like Fourier series)

 If x(t) is even (that is, symmetric)  FT is real (!) Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Properties of Fourier Transform

Property

Signal

Fourier Transform

The table is from Signals and Systems, H.P. Hsu (Schaum’s series), which uses ω for continuous frequencies. Replace all ω with Ω to be consistent with our notation. Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Common Fourier Transform Pairs

x(t)

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

X(ω)

Fourier Transform of a Periodic Signal t=0.01:0.01:10; d=0.5:2:9.5; y=pulstran(t,d,'rectpuls'); y2=y-0.5; y2=2*y; subplot(211) plot(t,y2) grid Y2=fft(y2); Y2=fftshift(Y2); subplot(212) stem(abs(Y2)) grid

Note that the FT of a periodic signal is discrete in the frequency domain!

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

RP

Fourier Transform of an Aperiodic Signal x(t )  e

3 t

sin(2t )

fs=100; t=-2:1/fs:2; x=exp(-3*abs(t)).*sin(2*t); Subplot(211) plot(t,x) grid X=fft(x); f=-fs/2:fs/(length(t)-1):fs/2; subplot(212) plot(f, abs(fftshift(X))) grid What kind of a system is this?

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

RP

In Simulink Function_generation

t

Ramp

eu

|u|

-3

Abs

Gain

Math Function Product

Scope1

Scope

Sine Wave Function Zero-Order Hold

OR

B-FFT Spectrum Scope

Note that spectrum scope is buffered. See model parameters f(u) Fcn

Zero-Order Hold1

Scope2

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

B-FFT Spectrum Scope1

ZOH is necessary to discretize the signal. FFT cannot be applied to continuous signals

RP

A More Complex Simulink Model function_generation.mdl

RP

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

A Computational Example  One of the most commonly used test signals in DSP is the rectangular pulse  1,  a / 2  t  a / 2  1, t  a / 2 x t      t a    0, t  a / 2 0, otherwise  

Π(t/2)

-a/2

 Calculate the CFT of this rectangular pulse X  



 x t  e



2

 jt

a

dt   1 e a

sin a sin a  2a  a

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

 jt

1 dt  e ja  e  ja   j

a/2

In Matlab function X=cft(x, t, W); Lx=length(x); w=linspace(-W, W, Lx);

You will be implementing this function in the lab. 1

dt=t(2)-t(1);

0.8

0.8

0.6

0.6

0.4

0.4

%Calculate the CFT. for i=1:Lx X(i)=sum(x.*exp(-j*w(i)*t))*dt;

end % plot subplot(2,2,[1 2])

Original signal signal Original

1

0.2

0.2

0 -5

0 -10

-4

-8

-3

-6

-4

-2

-2

0

-1

2

0

Real part of the CFT

0.5

1

4

2

6

3

8

4

10

5

Magntude of the CFT

Real part of the CFT

0.5

4

Magntude of the CFT

4

0.4

plot(t,x); grid title('Original signal') subplot(223) plot(w/pi,real(X)); grid

0.4 0.3 0.2

0.3

0.1

0.2

2 0

RP

1

0

0.1

title('Real part of the CFT')

-0.1

xlabel('Ang. Frequency in \pi rad/s')

-0.2 -10

subplot(224)

3

2

-2 -4

-2

0

2

-5 0 5 Ang.  rad/s Ang. Frequency Frequency in in rad/s

4

10

0 -4 0

-10

-2 0 2 -5 0 5 Ang. Frequency in rad/s  Ang. Frequency in  rad/s

4

10

plot(w/pi, abs(X)); grid xlabel('Ang. Frequency in \pi rad/s') title('Magntude of the CFT')

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

!!! Note that this is an approximation of the CFT calculated using discrete time computations !!!

Exercises  Try the following at home. What is being demonstrated here? What is the outcome? How do you interpret it? x=zeros(1000,1); x(500)=1; plot(x) close X=abs(fft(x)); plot(fftshift(X))

x=ones(1000,1); plot(x) X=abs(fft(x)); plot(fftshift(X))

…to be continued!

Digital Signal Processing, © 2010 Robi Polikar, Rowan University

Related Documents

Lecture 6
February 2021 3
Lecture
February 2021 3
Italy Lecture
January 2021 1
Lecture Notes
February 2021 1

More Documents from "Precious Diarez Pureza"