fourier representation of signals (matlab tutorial) · title: fourier representation of signals...

65
Fourier representation of signals Pouyan Ebrahimbabaie Laboratory for Signal and Image Exploitation (INTELSIG) Dept. of Electrical Engineering and Computer Science University of Liège Liège, Belgium Applied digital signal processing (ELEN0071-1) 19 February 2020 MATLAB tutorial series (Part 1.1)

Upload: others

Post on 08-Oct-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Fourier representation of signals

Pouyan Ebrahimbabaie

Laboratory for Signal and Image Exploitation (INTELSIG)

Dept. of Electrical Engineering and Computer Science

University of Liège

Liège, Belgium

Applied digital signal processing (ELEN0071-1)

19 February 2020

MATLAB tutorial series (Part 1.1)

Page 2: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Contacts

• Email: [email protected]

• Office: R81a

• Tel: +32 (0) 436 66 37 53

• Web:

http://www.montefiore.ulg.ac.be/~ebrahimbab

aie/

2

Page 3: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Fourier analysis is like a glass prism

Glass prism

AnalysisBeam ofsunlight

VioletBlueGreenYellowOrangeRed

Page 4: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Fourier analysis is like a glass prism

4

Glass prism

AnalysisBeam ofsunlight

VioletBlueGreenYellowOrangeRed

Beam ofsunlight Synthesis

White light

Page 5: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Fourier analysis in signal processing

• Fourier analysis is the decomposition of a signal into frequency components, that is, complex exponentials or sinusoidal signals.

Ori

gin

al s

ign

al

Page 6: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Fourier analysis in signal processing

• Fourier analysis is the decomposition of a signal into frequency components, that is, complex exponentials or sinusoidal signals.

Sin

uso

idal

sig

nal

sO

rigi

nal

sig

nal

=

Joseph Fourier

1768-1830

Page 7: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Motivation

Question: what is our motivation to describe each signal as a sum or integral of sinusoidal signals?

Page 8: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Motivation

Question: what is our motivation to describe each signal as a sum or integral of sinusoidal signals?

Answer: the major justification is that LTI systems have a simple behavior with sinusoidal inputs.

Notice: the response of a LTI system to a sinusoidal is sinusoid with the same frequency but different amplitude and phase.

Page 9: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Motivation

Question: what is our motivation to describe each signal as a sum or integral of sinusoidal signals?

Answer: the major justification is that LTI systems have a simple behavior with sinusoidal inputs.

Interesting application: we can remove selectively a desired frequency 𝛀𝒊 from the original signal using an

LTI system (i.e. “Filter”) by setting 𝑯 𝒆𝒋𝛀𝒊 = 𝟎.

Page 10: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Notations and abbreviations

Mathematical tools for frequency analysis depends on,

• Nature of time: continuous or discrete• Existence of harmonic: periodic or aperiodic

Page 11: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Notations and abbreviations

Mathematical tools for frequency analysis depends on,

• Nature of time: continuous or discrete• Existence of harmonic: periodic or aperiodic

The signal could be,

Continuous-time and periodic Continuous-time and aperiodic

Discrete-time and periodic Discrete-time and aperiodic

Page 12: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Notations and abbreviations

Mathematical tools for frequency analysis depends on,

• Nature of time: continuous or discrete• Existence of harmonic: periodic or aperiodic

The signal could be,

Continuous-time and periodic (freq. dom. CTFS)Continuous-time and aperiodic (freq. dom. CTFT)

Discrete-time and periodic (freq. dom. DTFS)Discrete-time and aperiodic (freq. dom. DTFT)

Page 13: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Notations and abbreviations

Mathematical tools for frequency analysis depends on,

• Nature of time: continuous or discrete• Existence of harmonic: periodic or aperiodic

The signal could be,

Continuous-time and periodic (freq. dom. CTFS)Continuous-time and aperiodic (freq. dom. CTFT)

Discrete-time and periodic (freq. dom. DTFS)Discrete-time and aperiodic (freq. dom. DTFT)

Notice: when the signal is periodic, we talk about Fourier series (FS).

Page 14: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Notations and abbreviations

Mathematical tools for frequency analysis depends on,

• Nature of time: continuous or discrete• Existence of harmonic: periodic or aperiodic

The signal could be,

Continuous-time and periodic (freq. dom. CTFS)Continuous-time and aperiodic (freq. dom. CTFT)

Discrete-time and periodic (freq. dom. DTFS)Discrete-time and aperiodic (freq. dom. DTFT)

Notice: when the signal is aperiodic, we talk about Fourier transform (FT).

Page 15: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Continuous-time periodic signal: CTFS

2pW0

T0

=

Continuous - time signals

x(t)

0

Time-domain Frequency-domain

Continuous and periodic Discrete and aperiodic

t 0

ck

W-T0 0

T

Page 16: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Continuous-time periodic signal: CTFS

2pW0

T0

=

Continuous - time signals

x(t)

0

Time-domain Frequency-domain

Continuous and periodic Discrete and aperiodic

t 0

ck

W-T0 0

T

Page 17: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Example: consider the following signal,

Page 18: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Example: consider the following signal,

Page 19: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Page 20: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Page 21: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Page 22: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From CTFS to CTFT

Page 23: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Continuous-time aperiodic signal: CTFT

Page 24: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Continuous-time aperiodic signal: CTFT

Page 25: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Continuous-time aperiodic signal: CTFT

Page 26: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Discrete-time periodic signal: DTFS

Discrete - time signals

x[n] ck

-N N0

Discrete and periodic Discrete and periodic

n k

Time-domain Frequency-domain

-N N0

Page 27: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Discrete-time periodic signal: DTFS

Discrete - time signals

x[n] ck

-N N0

Discrete and periodic Discrete and periodic

n k

Time-domain Frequency-domain

-N N0

Page 28: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Discrete-time aperiodic signal: DTFT

Discrete-time signals

X(e jw)

-4 -2 20 4 -2p -p 0 p 2p

Continous and periodic

n w

Time-domain Frequency-domain

Discrete and aperiodic

x[n]

Page 29: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Discrete-time aperiodic signal: DTFT

Discrete-time signals

X(e jw)

-4 -2 20 4 -2p -p 0 p 2p

Continous and periodic

n w

Time-domain Frequency-domain

Discrete and aperiodic

x[n]

Page 30: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Discrete-time aperiodic signal: DTFT

Discrete-time signals

X(e jw)

-4 -2 20 4 -2p -p 0 p 2p

Continous and periodic

n w

Time-domain Frequency-domain

Discrete and aperiodic

x[n]

Everything you need to know !

Page 31: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

31

Summary of Fourier series and transforms

Page 32: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

32

Periodicity with “period” 𝜶 in one

domain implies discretization

with “spacing” 𝟏 ⁄ 𝜶 in the other

domain, and vice versa.

Page 33: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Frequency : F (Hz)

Page 34: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Angular frequency: 𝛀 = 𝟐𝝅𝑭 (rad/sec)

Page 35: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Normalized frequency: f = 𝑭/𝑭𝒔 (cycles/samples)

Page 36: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Normalized angular frequency:

𝝎 = 𝟐𝝅 × 𝑭/𝑭𝒔 (radians x cycles/samples)

radians

Page 37: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Normalized angular frequency:

𝝎 = 𝟐𝝅 × 𝑭/𝑭𝒔 (radians x cycles/samples)

radians

Low Freq. High Freq.High Freq.

Page 38: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Numerical computation of DTFS

Formula MATLAB function

Let 𝒙 𝒏 be periodic and 𝒙 = 𝒙 𝟎 𝒙 𝟏 ,⋯ , 𝒙 𝑵 − 𝟏

includes first 𝑵 sampls.

Page 39: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.1: use of fft and ifft

Example 1: Compute the DFTS of pulse train with 𝑳=2 and 𝑵 =𝟏𝟎.

% signalx=[1 1 1 0 0 0 0 0 1 1]% NN=length(x);% ckc=fft(x)/Nx1=ifft(c)*N% plot x1stem(x1)title('ifft(c)*N')

Page 40: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Numerical computation of DTFT

The computation of a finite length sequence 𝒙[𝒏] that is

nonzero between 0 and 𝑵− 𝟏 at frequency 𝝎𝒌 is given

by,

Formula

X=freqz(x,1,om) % DTFT

MATLAB function

Page 41: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

Example 1.2: plot magnitude and phase spectrum of the

following signal

–10 –5 0 5 10 15 200

0.5

1

n

x[n

]

(a)𝒏

𝒙[𝒏]

Page 42: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% |X|X1=abs(X);% plot magnitude spectrum figure(1)plot(om,X1,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel('Magnitude |X|')

Page 43: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% |X|X1=abs(X);% plot magnitude spectrum figure(1)plot(om,X1,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel('Magnitude |X|')

Page 44: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% |X|X1=abs(X);% plot magnitude spectrum figure(1)plot(om,X1,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel('Magnitude |X|')

Page 45: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% |X|X1=abs(X);% plot magnitude spectrum figure(1)plot(om,X1,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel('Magnitude |X|')

Page 46: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% |X|X1=abs(X);% plot magnitude spectrum figure(1)plot(om,X1,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel('Magnitude |X|')

Page 47: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.2: use of freqz

% signalx=[1 1 1 1 1 1 1 1 1 1 1];% define omegaom=linspace(-pi,pi,500);% Compute DTFTX=freqz(x,1,om);% phasep=angle(X);% plot phase spectrum figure(2)plot(om,p,'LineWidth',2.5)xlabel('Normalized angular frequency')ylabel(‘Phase')

Page 48: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

Example 1.2: plot magnitude and phase spectrum of

𝒙 𝒏 = 𝟎. 𝟔 × 𝐬𝐢𝐧𝐜 (𝟎. 𝟔𝒏) for 𝒏 = −𝟐𝟎𝟎: 𝟏: 𝟐𝟎𝟎.

Page 49: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

% time t or nt=-200:1:200;% signalx=0.6*sinc(0.6.*t);% plots signalfigure(1)plot(t,x,'LineWidth',2.5)title('x')% define omegaom=linspace(-pi,pi,500);% compute DTFTX=freqz(x,1,om);% plot magnitude spectrumfigure(2)plot(om,abs(X),'LineWidth',2.5)

Page 50: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

% time t or nt=-200:1:200;% signalx=0.6*sinc(0.6.*t);% plots signalfigure(1)plot(t,x,'LineWidth',2.5)title('x')% define omegaom=linspace(-pi,pi,500);% compute DTFTX=freqz(x,1,om);% plot magnitude spectrumfigure(2)plot(om,abs(X),'LineWidth',2.5)

Page 51: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

% time t or nt=-200:1:200;% signalx=0.6*sinc(0.6.*t);% plots signalfigure(1)plot(t,x,'LineWidth',2.5)title('x')% define omegaom=linspace(-pi,pi,500);% compute DTFTX=freqz(x,1,om);% plot magnitude spectrumfigure(2)plot(om,abs(X),'LineWidth',2.5)

Page 52: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

% time t or nt=-200:1:200;% signalx=0.6*sinc(0.6.*t);% plots signalfigure(1)plot(t,x,'LineWidth',2.5)title('x')% define omegaom=linspace(-pi,pi,500);% compute DTFTX=freqz(x,1,om);% plot magnitude spectrumfigure(2)plot(om,abs(X),'LineWidth',2.5)

Page 53: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.3: use of freqz

% time t or nt=-200:1:200;% signalx=0.6*sinc(0.6.*t);% plots signalfigure(1)plot(t,x,'LineWidth',2.5)title('x')% define omegaom=linspace(-pi,pi,500);% compute DTFTX=freqz(x,1,om);% scale it by factor pifigure(2)plot(om/pi,abs(X),'LineWidth',2.5)

Page 54: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.4: use of freqz

Example 1.2: plot magnitude and phase spectrum of

𝒙 𝒏 = 𝟎. 𝟔 × 𝐬𝐢𝐧𝐜 (𝟎. 𝟔𝒏) for 𝒏 = −𝟐𝟎𝟎: 𝟎. 𝟏: 𝟐𝟎𝟎.

You should scale freqz(x,1,om) by Ts

(i.e. X=Ts* freqz(x,1,om)).

More details in the future sessions…

Page 55: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Main application of freqz(b,a,om)

𝑯 𝒛 =𝑩(𝒛)

𝑨(𝒛)=

𝒃 𝟏 + 𝒃 𝟐 𝒛−𝟏 +⋯+ 𝒃(𝒏)𝒛−(𝒏−𝟏)

𝒂 𝟏 + 𝒂 𝟐 𝒛−𝟏 +⋯+ 𝒂(𝒎)𝒛−(𝒎−𝟏)

Page 56: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Main application of freqz(b,a,om)

𝑯 𝒛 =𝑩(𝒛)

𝑨(𝒛)=

𝒃 𝟏 + 𝒃 𝟐 𝒛−𝟏 +⋯+ 𝒃(𝒏)𝒛−(𝒏−𝟏)

𝒂 𝟏 + 𝒂 𝟐 𝒛−𝟏 +⋯+ 𝒂(𝒎)𝒛−(𝒎−𝟏)

For 𝒛 = 𝒆𝒋𝝎 one can write,

𝑯 𝒆𝒋𝝎 =𝑩(𝒆𝒋𝝎)

𝑨(𝒆𝒋𝝎)=

𝒃 𝟏 + 𝒃 𝟐 𝒆−𝒋𝝎 +⋯+ 𝒃(𝒏)𝒆−𝒋(𝒏−𝟏)𝝎

𝒂 𝟏 + 𝒂 𝟐 𝒆−𝒋𝝎 +⋯+ 𝒂(𝒎)𝒆−𝒋(𝒎−𝟏)𝝎

Page 57: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Main application of freqz(b,a,om)

𝑯 𝒛 =𝑩(𝒛)

𝑨(𝒛)=

𝒃 𝟏 + 𝒃 𝟐 𝒛−𝟏 +⋯+ 𝒃(𝒏)𝒛−(𝒏−𝟏)

𝒂 𝟏 + 𝒂 𝟐 𝒛−𝟏 +⋯+ 𝒂(𝒎)𝒛−(𝒎−𝟏)

For 𝒛 = 𝒆𝒋𝝎 one can write,

𝑯 𝒆𝒋𝝎 =𝑩(𝒆𝒋𝝎)

𝑨(𝒆𝒋𝝎)=

𝒃 𝟏 + 𝒃 𝟐 𝒆−𝒋𝝎 +⋯+ 𝒃(𝒏)𝒆−𝒋(𝒏−𝟏)𝝎

𝒂 𝟏 + 𝒂 𝟐 𝒆−𝒋𝝎 +⋯+ 𝒂(𝒎)𝒆−𝒋(𝒎−𝟏)𝝎

b= [b(1),…,b(n)]; % vector b numeratora= [a(1),…,a(n)]; % vector a denominatorom=linspace(-pi,pi,k); % desired frequency rangeH=freqz(b,a,om); % system frequency response

Page 58: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From ZT to DTFT

Page 59: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From ZT to DTFT

Page 60: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

From ZT to DTFT

Page 61: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.5: frequency response

Example 1.2: plot magnitude and phase spectrum of a

system with zeros 𝒛𝟏,𝟐 = ±𝟏 and 𝒑𝟏,𝟐 = 𝟎. 𝟗𝒆±𝒋𝝅/𝟒.

Page 62: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.5: frequency response

Example 1.2: plot magnitude and phase spectrum of a

system with zeros 𝒛𝟏,𝟐 = ±𝟏 and 𝒑𝟏,𝟐 = 𝟎. 𝟗𝒆±𝒋𝝅/𝟒.

% zeroszer = [-1 1];% ploespol=0.9*exp(1i*pi*1/4*[-1 +1]);% Turn it to rational transfer function[b,a]=zp2tf(zer',pol',1);% omegaom=linspace(-pi,pi,500);% freq. responseX=freqz(b,a,om);% magnitude response scaled by pifigure(1)plot(om/pi,abs(X),'LineWidth',2.5)xlabel('Normalized frequency (\pi x rad/sample) ')

Page 63: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.5: frequency response

Example 1.2: plot magnitude and phase spectrum of a

system with zeros 𝒛𝟏,𝟐 = ±𝟏 and 𝒑𝟏,𝟐 = 𝟎. 𝟗𝒆±𝒋𝝅/𝟒.

% zeroszer = [-1 1];% ploespol=0.9*exp(1i*pi*1/4*[-1 +1]);% Turn it to rational transfer function[b,a]=zp2tf(zer',pol',1);% omegaom=linspace(-pi,pi,500);% freq. responseX=freqz(b,a,om);% magnitude response scaled by pifigure(1)plot(om/pi,abs(X),'LineWidth',2.5)xlabel('Normalized frequency (\pi x rad/sample) ')

Page 64: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Example 1.5: frequency response

Example 1.2: plot magnitude and phase spectrum of a

system with zeros 𝒛𝟏,𝟐 = ±𝟏 and 𝒑𝟏,𝟐 = 𝟎. 𝟗𝒆±𝒋𝝅/𝟒.

% zeroszer = [-1 1];% ploespol=0.9*exp(1i*pi*1/4*[-1 +1]);% Turn it to rational transfer function[b,a]=zp2tf(zer',pol',1);% omegaom=linspace(-pi,pi,500);% freq. responseX=freqz(b,a,om);% magnitude response scaled by pifigure(1)plot(om/pi,abs(X),'LineWidth',2.5)xlabel('Normalized frequency (\pi x rad/sample) ')

Page 65: Fourier representation of signals (MATLAB tutorial) · Title: Fourier representation of signals (MATLAB tutorial) Author: pouyan varnosfaderani Created Date: 2/19/2020 10:43:21 AM

Useful links

• https://nl.mathworks.com/help/signal/ref/freqz.html

• https://nl.mathworks.com/help/signal/ref/angle.html

• https://nl.mathworks.com/help/matlab/ref/fft.html

• https://www.12000.org/my_notes/on_scaling_factor_fo

r_ftt_in_matlab/index.htm