0% found this document useful (0 votes)
19 views638 pages

Signal Processing Course Overview

The document outlines the course CMPE 362, focusing on signal processing for computer engineering, led by Prof. Dr. Fatih Alagöz. It introduces key concepts such as signals, systems, and their mathematical representations, emphasizing the relevance of signal processing in various fields including multimedia, communications, and health. The course will utilize MATLAB for practical exercises and includes a variety of supplementary materials to enhance understanding.

Uploaded by

bexarot830
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views638 pages

Signal Processing Course Overview

The document outlines the course CMPE 362, focusing on signal processing for computer engineering, led by Prof. Dr. Fatih Alagöz. It introduces key concepts such as signals, systems, and their mathematical representations, emphasizing the relevance of signal processing in various fields including multimedia, communications, and health. The course will utilize MATLAB for practical exercises and includes a variety of supplementary materials to enhance understanding.

Uploaded by

bexarot830
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

cmpe 362- Introduction to Signal

Processing for Computer Eng.

Instructor: Prof. Dr. Fatih Alagöz (2012- ….)

TA: Özdeniz Dolu

Previous TA/SA:
TA:Emre Bilgili (2022)
TA:Mete Tuluhan Akbulut (2019-2021)
SA: Adalet Turgut Veyis (2021)
TA: Yekta Said Can (2014-2019)
TA: Ozlem Salehi (2012-2014)
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

I will first start with an overview of the ideas contained in this lecture about signals and systems.

Since we are living in an age of multimedia, audio, video, infotainment, AR/VR entertainment systems,
computational analysis for almost everything e.g. behavioral /clinical sciences, IoT, body dynamics, face
analysis, wearable devices, space travel, Industry 4.0, 5G and beyond digital communications systems,
etc, it is almost certain that you have been formed with some impression of the meaning of the terms
“signal” and “system”.
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

It is quite likely that your usage and understanding of the term signal and system are partially correct. For
example, you make think of a signal for something that carries information.

Usually that something is a pattern of variations with physical quantity that can be manipulated, stored or
transmitted by physical processes.

The terms “signal” and “system” maybe somewhat harder to pin down because they have variety of meanings.
As of January 2022, Google searches result in 1.48 billion and 6.43 billion for the former and latter ,
respectively. For example, the word “system” might refer to a large organization such as the Financial System
or Social Security system.
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

However, we are interested in a much narrower definition that is very closely linked to
signals. For our purposes a system is something that can operate on signals to produce
new signals or new signal representations. For example an Audio compact disc player is
a system for converting the music signals stored on the CD to an acoustic signal that we
can hear.

The Recording is digital because it represents the music signal as sequence of numbers.

Our goal in this course is to develop a framework that makes precise statements about
those signals and systems.

We will use mathematics as the appropriate language for describing and understanding
signals and systems.
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

We want to show how mathematical equations allow us to represent signals and systems
into design, and implement systems that achieve a prescribed purpose.

In the lectures to come, we will start with the basics of sine and cosine functions and
than show how complex numbers can simplify the algebra of these trigonometric
functions.

We will than introduce the concept of the frequency spectrum of a signal in the concept
of filtering with a Linear Time Invariant (LTI) system.
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

For each lecture we will provide demonstrations, labs, solved homework problems.

These will be ready on the course Moodle site, and there are also links in the text of the
CD demos for individual sections of the text book.

Supplementary materials should provide a broader perspective among these topics than
what might be gained by just reading the book or just listening to me.
cmpe 362- Introduction to Signal Processing for Computer Eng.
INTRO

Unfortunately given the limited resources at hand, we will prepare our best to teach this
course in online form.

Since you may experience connection problems, we will generally be on somewhat slow
mode of teaching. Please stop me at times when you are lost when surfing in
mathematics.

Please also search the Internet for better recordings/presentations of each topic we
discuss in class and share it with your friends.

In this course we will use MATLAB as an exercise tool for all kind of technical
computation like data and algorithm analysis, simulations, etc .
What is Signal?
 Signal is the variation of a physical quantity with respect to one or more
independent variable

 A signal is a function

Example 1: Voltage on a capacitor as a function of time


R
+
Vs I
i C Vc
-

RC circuit

8
Example 2: Vocoder Signal

Example 2: Two different vocoder signals of “Otuz yedi derece”…


The difference is due to physical structure of plica vocalis characterized by gender, age,
accent, emotion, energy, vocoder (voice encoder) structures, background noise, etc…..
9
Example 4:Image as a function of x-y coordinates
Example 3 : Closing value of the stock exchange (e.g. 256 X 256 pixel image)
index as a function of days

Index

MT W T F
Fig. Stock exchange

10
is this a signal ?

Dear CMPE Students

11
Signal Processing
Process signal(s) for solving many scientific/ engineering/ theoretical purposes

The process includes Calculus, Differential equations, Difference equations,


Transform theory, Linear time-invariant system theory, System identification and
classification, Time-frequency analysis, Spectral estimation, Vector spaces and
Linear algebra, Functional analysis, statistical signals and stochastic processes,
Detection theory, Estimation theory, Optimization, Numerical methods, Time series,
Data mining, etc

“The IEEE Transactions on Signal Processing covers novel theory, algorithms,


performance analyses and applications of techniques for the processing,
understanding, learning, retrieval, mining, and extraction of information from
signals. The term "signal" includes, among others, audio, video, speech, image,
communication, geophysical, sonar, radar, medical and musical signals. Examples
of topics of interest include, but are not limited to, information processing and the
theory and application of filtering, coding, transmitting, estimating, detecting,
analyzing, recognizing, synthesizing, recording, and reproducing signals”
12
REFERENCE: IEEE Transactions on Signal Processing Journal
Signal processing everywhere

x(t) or x(n) y(t) or y(n)


SYSTEM
(PROCESS)
INPUT SIGNAL OUTPUT SIGNAL

 Audio, speech, image, video applications,


 Communications ranging from nanoscale to deep-space
 Sonar, radar, geosensing, array processing
 Control systems (all industry)
 Seismology, Meteorology
 Finance, Health, Security, etc.

IT IS GOOD TO TAKE THIS COURSE 


13
CMPE362 IN A SINGLE SLIDE
Use H(z) to get Z-TRANSFORM-DOMAIN: poles & zeros
Freq. Response POLYNOMIALS: H(z)

H( z) =
å bk z -k
jwˆ
1- åaz - z=e

TIME-DOMAIN FREQ-DOMAIN
N M M
y[n]   a y[n  ]   bk x[n  k ] k  jˆ k
b e
1 k 0 H (e jˆ )  k 0
N
1   ae  jˆ 
4/3/2024
14
1
Signal Processing First

LECTURE #1
Sinusoids
LECTURE OBJECTIVES

 Write general formula for a “sinusoidal”


waveform, or signal
 From the formula, plot the sinusoid versus
time

 A signal is a function of time, x(t)


 in the mathematical sense

4/3/2024 2003 rws/jMc 17


Online Tone Generator
EXAMPLE:

Acos(w t + j )
A cos(2 (440)t   )
 “A” is at 440 Hertz (Hz)
 Waveform is a SINUSOIDAL SIGNAL
 Computer plot looks like a sine wave
 Mathematical representation
[Link]/tone-generator/
4/3/2024 2003 rws/jMc 18
SINUSOID AMPLITUDE EXAMPLES
0.25 sin(2π 300t) 0.5sin(2π 300t)

1 sin(2π 300t)
Tone Signals with Different Amplitudes:

Amplitude (1 unit): Asin(2π*300t)

Amplitude (5 unit): = 5*Asin(2π*300t)

Amplitude (10 unit): 10*A sin(2π*300t)

4/3/2024 19
SINUSOID FREQUENCY EXAMPLES

1-)1.00sin(2π*300t)
2-)1.00*sin(2π*600t)
3-)1.00*sin(2π*1200t)

Different Amplitude Sound Examples


Amplitude = 1.00sin(2π*300t)

Amplitude = 1.00sin(2π*600t)

Amplitude = 1.00sin(2π*1200t)
4/3/2024 20
SINUSOID PHASE EXAMPLES

1-)1.00sin(2π*300t)
2-)1.00*sin(2π*300t+ π/2)
3-)1.00*sin(2π*300t+ π)

4/3/2024 21
HUMAN VOICE WITH DIFFERENT
SAMPLING FREQUENCIES
With the original sampling frequency Fs

When sampled with Fs/2

When sampled with 2*Fs

When sampled with 5*Fs

4/3/2024 22
TIME VS FREQUENCY REPRESENTATION OF
ONE CLAP RECORD(SPECTROGRAM)

4/3/2024 23
TIME VS FREQUENCY REPRESENTATION OF
TWO CLAPS RECORD (SPECTROGRAM)

4/3/2024 24
Time vs Frequency Representation of Clap + Snap
Record (Spectrogram) (First Clap Then Finger Snap)

4/3/2024 25
TUNING FORK A-440 Waveform

T  8.15  5.85
 2.3 ms

Time (sec)

f  1/ T
 1000 / 2.3
 435 Hz
4/3/2024 2003 rws/jMc 26
SPEECH EXAMPLE

 Relatively more complicated signal


([Link])
 Waveform x(t) is NOT a simple Sinusoid
 Theory will tell us
 x(t) is approximately a sum of sinusoids
 FOURIER ANALYSIS
 Break x(t) into its sinusoidal components
 Called the FREQUENCY SPECTRUM
4/3/2024 2003 rws/jMc 27
Speech Signal: BAT

 Nearly Periodic in Vowel Region


 Period is (Approximately) T = 0.0065 sec

4/3/2024 2003 rws/jMc 28


DIGITIZE the WAVEFORM

 x[n] is a SAMPLED SINUSOID


 A list of numbers stored in memory
 Sample at 11,025 samples per second
 Called the SAMPLING RATE of the A/D
 Time between samples is
 1/11025 = 90.7 microsec
 Output via D/A hardware (at Fsamp)

4/3/2024 2003 rws/jMc 29


STORING DIGITAL SOUND

 x[n] is a SAMPLED SINUSOID


 A list of numbers stored in memory
 CD rate is 44,100 samples per second
 16-bit samples
 Stereo uses 2 channels
 Number of bytes for 1 minute is
 2 X (16/8) X 60 X 44100 = 10.584 Mbytes

4/3/2024 2003 rws/jMc 30


SINUSOIDAL SIGNAL

Acos(w t + j )
 FREQUENCY w
 Radians/sec
 AMPLITUDE
 Magnitude
A
 Hertz (cycles/sec)

w = (2p ) f
 PERIOD (in sec)
 PHASE j
1 2p
T= =
4/3/2024 f w 2003 rws/jMc 32
EXAMPLE of SINUSOID
 Given the formula 5 cos(0.3 t  1.2 )
A=5
 Formula defines w = 0.3p
 Make a plot j = 1.2 p

4/3/2024 2003 rws/jMc 33


PLOT COSINE SIGNAL
from the FORMULA

5 cos(0.3 t  1.2 )
 Determine period:
T  2 /   2 / 0.3  20 / 3
 Determine a peak location by solving
(t   )  0  (0.3 t  1.2 )  0
 Zero crossing is T/4 before or after
 Positive & Negative peaks spaced by T/2
4/3/2024 2003 rws/jMc 34
PLOT the SINUSOID

5 cos(0.3 t  1.2 )
 Use T=20/3 and the peak location at t=-4

  20
3

4/3/2024 2003 rws/jMc 35


TIME-SHIFT by tm unit

 In a mathematical formula we can replace


t with t-tm
x(t  tm )  A cos( (t  tm ))
 Then the t=0 point moves to t=tm

 Peak value of cos((t-tm)) is now at t=tm

4/3/2024 © 2003, JH McClellan & RW Schafer 36


TIME-SHIFTED SINUSOID

x(t  4)  5 cos(0.3 (t  4))  5 cos(0.3 (t  (4))

4/3/2024 © 2003, JH McClellan & RW Schafer 37


PHASE <--> TIME-SHIFT

 Equate the formulas:

A cos( (t  tm ))  A cos( t   )
 and we obtain:   tm  
 or, 
tm  

4/3/2024 © 2003, JH McClellan & RW Schafer 38
SINUSOID from a PLOT

 Measure the period, T


 Between peaks or zero crossings
3 steps
 Compute frequency:  = 2/T
 Measure time of a peak: tm
 Compute phase:  = -tm
 Measure height of positive peak: A

4/3/2024 © 2003, JH McClellan & RW Schafer 39


(A, , ) from a PLOT

T  10period
.01sec
 100
1
 2
T  2
0.01  200 
tm  0.00125 sec    tm  (200  )(tm )  0.25
4/3/2024 © 2003, JH McClellan & RW Schafer 40
SINE DRILL (MATLAB GUI)

4/3/2024 © 2003, JH McClellan & RW Schafer 41


PHASE
 The cosine signal is periodic
 Period is 2
A cos( t    2 )  A cos( t   )
 Thus adding any multiple of 2 leaves x(t)
unchanged

if tm  
, then
 (  2 ) 
tm2  
 
 2  tm  T
4/3/2024 © 2003, JH McClellan & RW Schafer 42
COMPLEX NUMBERS-
review

 To solve: z2 = -1
z=j
 Math and Physics use z = i
 Complex number: z = x + j y
y z
Cartesian
coordinate
x system

4/3/2024 © 2003, JH McClellan & RW Schafer 43


PLOT COMPLEX NUMBERS

4/3/2024 © 2003, JH McClellan & RW Schafer 44


COMPLEX ADDITION =
VECTOR Addition

z3  z1  z2
 (4  j 3)  (2  j5)
 (4  2)  j ( 3  5)
4/3/2024
 6  j2
© 2003, JH McClellan & RW Schafer 45
*** POLAR FORM ***

 Vector Form
 Length =1
 Angle = 
 Common Values
 j has angle of 0.5
 1 has angle of 
  j has angle of 1.5
 also, angle of j could be 0.51.52

4/3/2024 © 2003, JH McClellan & RW Schafer 46


POLAR <--> RECTANGULAR

 Relate (x,y) to (r,) r


2 2 2
y
r x y 

 1 y
Tan x  x  r cos
x

Most calculators do
Polar-Rectangular y  r sin 
Need a notation for POLAR FORM
4/3/2024 © 2003, JH McClellan & RW Schafer 47
Euler’s FORMULA

 Complex Exponential
 Real part is cosine
 Imaginary part is sine
 Magnitude is one
j
e  cos( )  j sin( )
j
re  r cos( )  jr sin( )
4/3/2024 © 2003, JH McClellan & RW Schafer 48
COMPLEX EXPONENTIAL
j t
e  cos( t )  j sin( t )
 Interpret this as a Rotating Vector
 t
 Angle changes vs. time
 ex: rad/s
 Rotates  in 0.01 secs
j
e  cos( )  j sin( )
4/3/2024 © 2003, JH McClellan & RW Schafer 49
cos = REAL PART
Real Part of Euler’s
j t
cos( t )  e{ e }
General Sinusoid
x(t )  A cos( t   )
So, j ( t  )
A cos( t   )  e{ Ae }
j j t
 e{ Ae e }
4/3/2024 © 2003, JH McClellan & RW Schafer 50
REAL PART EXAMPLE

Acos( t   )  e Ae e  j j t

Evaluate:

Answer:
x(t )  e  3 je  j t


x (t )  e ( 3 j )e j t

 e 3e
4/3/2024
  j 0.5
e j t
 3cos( t  0.5 ) 51
© 2003, JH McClellan & RW Schafer
COMPLEX AMPLITUDE
General Sinusoid
x(t )  A cos( t   )  e Ae e  j jt

Complex AMPLITUDE = X
jt j
z (t )  Xe X  Ae
Then, any Sinusoid = REAL PART of Xejt

x(t )  e Xe jt
 eAe j
e jt

4/3/2024 © 2003, JH McClellan & RW Schafer 52
AVOID Trigonometry
 Algebra, even complex, is EASIER !!!
 Can you recall cos(1+2) ?
 Use: real part of ej 1  2 = cos( + ) 1 2
j (1  2 ) j1 j 2
e e e
 (cos1  j sin 1 )(cos  2  j sin  2 )
 (cos1 cos 2  sin 1 sin  2 )  j (...)
4/3/2024 © 2003, JH McClellan & RW Schafer 54
Ex: Find Complex Amplitude
 Find the COMPLEX AMPLITUDE for:
x(t )  3 cos(77 t  0.5 )
 Use EULER’s FORMULA:


x(t )  e 3e j ( 77 t 0.5 )

 e 3e j 0.5
e j 77 t

j 0.5
4/3/2024 X  3e
© 2003, JH McClellan & RW Schafer 59
WANT to ADD TWO SINUSOIDS
(SAME FREQUENCY)

 If ALL SINUSOIDS have SAME FREQUENCY


 Find the {Amp,Phase} of Sum Signal,
x1(t) +x2(t)?

4/3/2024 © 2003, JH McClellan & RW Schafer 60


PHASOR ADDITION RULE

Get the new complex amplitude by complex addition

4/3/2024 © 2003, JH McClellan & RW Schafer 61


Phasor Addition Proof

4/3/2024 © 2003, JH McClellan & RW Schafer 62


Ex: Adding Sinusoids
 ADD THESE 2 SINUSOIDS:
x1 (t )  cos(77 t ) xTotal (t )  A cos(wt   )
x2 (t )  3 cos(77 t  0.5 ) A  ?, w  ?,  ?

 Using complex addition:


j 0.5
1e  3e
j0

4/3/2024 © 2003, JH McClellan & RW Schafer 63


POP QUIZ (answer)
 COMPLEX ADDITION:
j / 3
1  j 3  2e
j 0.5p
j 3 = 3e
1
 CONVERT back to cosine form:

x3 
(t )  2 cos(77 t  ) 3
4/3/2024 © 2003, JH McClellan & RW Schafer 64
ADD SINUSOIDS

 Sum Sinusoid has SAME Frequency

4/3/2024 © 2003, JH McClellan & RW Schafer 65


WANT to ADD SINUSOIDS
(SAME FREQUENCY)
 If ALL SINUSOIDS have SAME FREQUENCY
 HOW to GET {Amp,Phase} of RESULT ?

4/3/2024 © 2003, JH McClellan & RW Schafer 66


EX: ADDING TWO SINUSOIDS

x3 (t )  x1 (t )  x2 (t )

4/3/2024 © 2003, JH McClellan & RW Schafer 67


Convert Time-Shift to Phase

 Measure peak times:


 tm1=-0.0194, tm2=-0.0556, tm3=-0.0394
 Convert to phase (T=0.1)
 1=-tm1 = -2(tm1 /T) = 70/180,
 2= 200/180
 Amplitudes
 A1=1.7, A2=1.9, A3=1.532

4/3/2024 © 2003, JH McClellan & RW Schafer 68


Phasor Add: Numerical

 Convert Polar to Cartesian


 X1 = 0.5 + j1.5
 X2 = -1. - j0.6
 sum =
 X3 = -0.5 + j1
 Convert back to Polar
 X3 = 1. at angle 0.1
 This is the sum

4/3/2024 © 2003, JH McClellan & RW Schafer 69


ADD SINUSOIDS

X1

VECTOR
X3
(PHASOR)
ADD

4/3/2024 X2 © 2003, JH McClellan & RW Schafer 70


Quiz, 2021-F

x1 (t )  cos(77 t )
x2 (t )  cos(77 t  0.5 )
x3 (t )  x1 (t )  x2 (t )  A cos(wt   )

4/3/2024 © 2003, JH McClellan & RW Schafer 71


Further Materials 2022-S

[Link]
[Link]

4/3/2024 © 2003, JH McClellan & RW Schafer 72


Signal Processing First

Lecture 4
Spectrum Representation

4/3/2024 © 2003, JH McClellan & RW Schafer 1


READING ASSIGNMENTS

 This Lecture:
 Chapter 3, Section 3-1

 Other Reading:
 Appendix A: Complex Numbers

 Next Lecture: Ch 3, Sects 3-2, 3-3, 3-7 & 3-8

4/3/2024 © 2003, JH McClellan & RW Schafer 3


LECTURE OBJECTIVES

 Sinusoids with DIFFERENT Frequencies


 SYNTHESIZE by Adding Sinusoids
N
x(t )   Ak cos( 2 f k t   k )
k 1
 SPECTRUM Representation
 Graphical Form shows DIFFERENT Freqs

4/3/2024 © 2003, JH McClellan & RW Schafer 4


FREQUENCY DIAGRAM

10
j / 3  j / 3
7e 7e
 j / 2 j / 2
4e 4e

–250 –100 0 100 250


f (in Hz)

4/3/2024 © 2003, JH McClellan & RW Schafer 5


Another FREQ. Diagram
A-440
Frequency is the vertical axis

Time is the horizontal axis

4/3/2024 © 2003, JH McClellan & RW Schafer 6


MOTIVATION

 Synthesize Complicated Signals


 Musical Notes
 Most keys on the Piano strikes 3 strings when
depressed (88 keys may produce 230-240)
 Chords: play several notes simultaneously
 Human Speech
 Vowels have dominant frequencies
 Application: computer generated speech
 Can all signals be generated this way?
 Sum of sinusoids?
4/3/2024 © 2003, JH McClellan & RW Schafer 7
SPECTRUM Interpretation
 By using Euler’ eq. we show
jw t - jw t
cos(w t) = (e 1
2 +e )

A cos(7t )  A e j 7t  A e  j 7t
2 2
One has a positive frequency
The other has negative freq.
Amplitude of each is half as big

4/3/2024 © 2003, JH McClellan & RW Schafer 10


NEGATIVE FREQUENCY
 Consider a rotating wheel;
 The vector (cos(t), sin(t)) rotates counter-clockwise at 1 rad/sec (say positive freq.)
 The vector (cos(-t), sin(-t)) rotates clockwise at 1 rad/sec (say negative freq.)

 Doppler RADAR (Radio Detection And Ranging) provides a practical example


 Police radar measures speed by using the Doppler shift principle.
 Let’s assume 400Hz 60 mph
 +400Hz means wave propagates towards the radar
 -400Hz means away (opposite direction)
 Think of a train whistle.

[Link]

4/3/2024 © 2003, JH McClellan & RW Schafer 11


SPECTRUM of SINE
 Sine = sum of 2 complex exponentials:
A j 7t A  j 7t
A sin( 7t )  2 j e  2 j e
1  j 0.5 j 7 t 1 j 0.5  j 7 t
 2 Ae e  2 Ae e
1  j 0.5
j
je
 Positive freq. has phase = -0.5
 Negative freq. has phase = +0.5
4/3/2024 © 2003, JH McClellan & RW Schafer 12
GRAPHICAL SPECTRUM
EXAMPLE of SINE
1  j 0.5 j 7t 1 j 0.5  j 7t
Asin( 7t )  Ae
2
e  Ae
2
e

1 j 0.5 1  j 0.5
(2 A)e (2 A)e

-7 0 7 

AMPLITUDE, PHASE & FREQUENCY are shown

4/3/2024 © 2003, JH McClellan & RW Schafer 13


SPECTRUM ---> SINUSOID
 Add the spectrum components:
10
j / 3 7e  j / 3
7e
 j / 2 4e j / 2
4e

–250 –100 0 100 250


f (in Hz)

What is the formula for the signal x(t)?


4/3/2024 © 2003, JH McClellan & RW Schafer 14
Gather (A,) information

 Frequencies:  Amplitude & Phase


 -250 Hz  4 -/2
 -100 Hz  7 +/3
 0 Hz  10 0
 100 Hz  7 -/3
 250 Hz  4 +/2
Note the conjugate phase
DC is another name for zero-freq component
DC component always has or (for real x(t) )
4/3/2024 © 2003, JH McClellan & RW Schafer 16
Add Spectrum Components-1
 Frequencies:  Amplitude & Phase
 -250 Hz  4 -/2
 -100 Hz  7 +/3
 0 Hz  10 0
 100 Hz  7 -/3
 4 +/2
 250 Hz

x(t )  10 
 j / 3 j 2 (100) t j / 3  j 2 (100) t
7e e  7e e
j / 2 j 2 ( 250) t  j / 2  j 2 ( 250) t
4e e  4e e
4/3/2024 © 2003, JH McClellan & RW Schafer 17
Simplify Components

x(t )  10 
 j / 3 j 2 (100) t j / 3  j 2 (100) t
7e e  7e e
j / 2 j 2 ( 250) t  j / 2  j 2 ( 250) t
4e e  4e e
Use Euler’s Formula to get REAL sinusoids:

 j j t  j  j t
A cos( t   )  Ae 1
2
e 1
 Ae
2
e
4/3/2024 © 2003, JH McClellan & RW Schafer 18
FINAL ANSWER

x(t )  10  14 cos(2 (100)t   / 3)


 8 cos(2 (250)t   / 2)
So, we get the general form:
N
x(t )  A0   Ak cos( 2 f k t   k )
k 1
4/3/2024 © 2003, JH McClellan & RW Schafer 19
Summary: GENERAL FORM
N
x(t )  A0   Ak cos( 2 f k t   k )
k 1

 
N
x(t )  X 0   e X k e j 2 f k t
j k
k 1 X k  Ak e
e{z}  12 z  1 z Frequency  f k
2

 
N
x (t )  X 0   1
2
Xke j 2 f k t
 1
2
  j 2 f k t
Xke
k 1
4/3/2024 © 2003, JH McClellan & RW Schafer 20
Example: Synthetic Vowel

 Sum of 5 Frequency Components

4/3/2024 © 2003, JH McClellan & RW Schafer 21


SPECTRUM of VOWEL
 Note: Spectrum has 0.5Xk (except XDC)
 Conjugates in negative frequency

4/3/2024 © 2003, JH McClellan & RW Schafer 22


SPECTRUM of VOWEL
(Polar Format)

0.5Ak

k

4/3/2024 © 2003, JH McClellan & RW Schafer 23


Vowel Waveform
(sum of all 5 components)

4/3/2024 © 2003, JH McClellan & RW Schafer 24


Signal Processing First

Lecture 5
Periodic Signals, Harmonics
& Time-Varying Sinusoids

4/3/2024 © 2003, JH McClellan & RW Schafer 25


READING ASSIGNMENTS
 This Lecture:
 Chapter 3, Sections 3-2 and 3-3
 Chapter 3, Sections 3-7 and 3-8

 Next Lecture:
 Fourier Series ANALYSIS
 Sections 3-4, 3-5 and 3-6

4/3/2024 © 2003, JH McClellan & RW Schafer 26


Problem Solving Skills

 Math Formula  Plot & Sketches


 Sum of Cosines  S(t) versus t
 Amp, Freq, Phase  Spectrum

 Recorded Signals  MATLAB


 Speech  Numerical
 Music  Computation
 No simple formula  Plotting list of
numbers

4/3/2024 © 2003, JH McClellan & RW Schafer 27


LECTURE OBJECTIVES
 Signals with HARMONIC Frequencies
 Add Sinusoids with fk = kf0
N
x(t )  A0   Ak cos( 2 kf0t   k )
k 1
FREQUENCY can change vs. TIME
Chirps: 2
x(t) = cos(at )
Introduce Spectrogram Visualization (specgram.m)
(plotspec.m)
4/3/2024 © 2003, JH McClellan & RW Schafer 28
SPECTRUM DIAGRAM

 Recall Complex Amplitude vs. Freq


1 X k 10 1 X k  ak
2 j / 3  j / 3 2
7e 7e
 j / 2 j / 2
4e j k
4e
X k  Ak e
–250 –100 0 100 250
f (in Hz)

x(t )  10  14 cos(2 (100)t   / 3)


 8 cos(2 (250)t   / 2)
4/3/2024 © 2003, JH McClellan & RW Schafer 29
SPECTRUM for PERIODIC ?
 Nearly Periodic in the Vowel Region
 Period is (Approximately) T = 0.0065 sec

4/3/2024 © 2003, JH McClellan & RW Schafer 30


PERIODIC SIGNALS

 Repeat every T secs


 Definition
x (t )  x (t  T )
 Example:
T ?
x(t) = cos(3t)

 Speech can be “quasi-periodic”

4/3/2024 © 2003, JH McClellan & RW Schafer 31


Period of Complex Exponential
j t
x (t )  e
x (t  T )  x (t ) ? Definition: Period is T

j ( t T ) j t
e e e j 2 k  1
jT
e  1  T  2 k
2 k  2 
  k   0k k = integer

4/3/2024
T  T 
© 2003, JH McClellan & RW Schafer 32
Harmonic Signal Spectrum

Periodic signal can only have : f k  k f 0


N
x (t )  A0   Ak cos( 2 kf0t   k )
1
k 1 f0 
j k T
X k  Ak e

 
N
x (t )  X 0   1
2
X ke j 2 kf0t
 1
2
  j 2 kf0t
X ke
k 1
4/3/2024 © 2003, JH McClellan & RW Schafer 33
Define FUNDAMENTAL FREQ
N
x(t) = A0 + Ak cos(2p kf0 t + fk )
k=1

fk = k f0 (w 0 = 2p f0 ) 1
f0 
T0
f0 = fundamental Frequency
T0 = fundamental Period
4/3/2024 © 2003, JH McClellan & RW Schafer 34
Harmonic Signal (3 Freqs)

3rd
5th

What is the fundamental frequency?

4/3/2024 © 2003, JH McClellan & RW Schafer 35


Harmonic Signal (3 Freqs)

3rd
5th

What is the fundamental frequency? 10 Hz

4/3/2024 © 2003, JH McClellan & RW Schafer 36


POP QUIZ: FUNDAMENTAL
 Here’s another spectrum:
10
j / 3  j / 3
7e 7e
 j / 2 j / 2
4e 4e

–250 –100 0 100 250


f (in Hz)

What is the fundamental frequency?

4/3/2024 © 2003, JH McClellan & RW Schafer 37


Harmonic Signal (3 Freqs)
T=0.1

4/3/2024 © 2003, JH McClellan & RW Schafer 38


NON-Harmonic Signal

NOT
4/3/2024 © 2003, JH McClellan & RW Schafer PERIODIC
39
FREQUENCY ANALYSIS
 Given a recording of a song, have the
computer write the music

 Can a machine extract frequencies?


 Yes, if we COMPUTE the spectrum for x(t)
 During short intervals

4/3/2024 © 2003, JH McClellan & RW Schafer 40


Time-Varying
FREQUENCIES Diagram
A-440
Frequency is the vertical axis

Time is the horizontal axis


4/3/2024 © 2003, JH McClellan & RW Schafer 41
SIMPLE TEST SIGNAL
 C-major SCALE: stepped frequencies
 Frequency is constant for each note

IDEAL

4/3/2024 © 2003, JH McClellan & RW Schafer 42


Hands on with MATLAB
 SPECTROGRAM Tool
 MATLAB function is specgram.m
 SP-First has plotspec.m & spectgr.m
 ANALYSIS program
 Takes x(t) as input &
 Produces spectrum values Xk
 Breaks x(t) into SHORT TIME SEGMENTS
 Then uses the FFT (Fast Fourier Transform)

4/3/2024 © 2003, JH McClellan & RW Schafer 43


SPECTROGRAM EXAMPLE
 Two Constant Frequencies: Beats

cos( 2 (660)t ) sin( 2 (12)t )

4/3/2024 © 2003, JH McClellan & RW Schafer 44


AM Radio Signal
 Same as BEAT Notes
cos( 2 (660)t ) sin( 2 (12)t )
1
2
e j 2 ( 660) t
 e  j 2 ( 660) t  e
1
2j
j 2 (12) t
 e  j 2 (12) t 
1
4j
e j 2 ( 672) t
 e  j 2 ( 672) t  e j 2 ( 648) t  e  j 2 ( 648) t 
1 cos( 2 (672)t  2 )  12 cos(2 (648)t  2 )
2

4/3/2024 © 2003, JH McClellan & RW Schafer 45


SPECTRUM of AM (Beat)
 4 complex exponentials in AM:

1
4
e j / 2 1
4
e j / 2 1
4
e j / 2 1
4
e j / 2

–672 –648 0 648 672


f (in Hz)

What is the fundamental frequency?

648 Hz ? 24 Hz ?
4/3/2024 © 2003, JH McClellan & RW Schafer 46
STEPPED FREQUENCIES
 C-major SCALE: successive sinusoids
 Frequency is constant for each note

IDEAL

4/3/2024 © 2003, JH McClellan & RW Schafer 47


SPECTROGRAM of C-Scale
Sinusoids ONLY

From SPECGRAM
ANALYSIS PROGRAM

ARTIFACTS at Transitions

4/3/2024 © 2003, JH McClellan & RW Schafer 48


Spectrogram of LAB SONG

Sinusoids ONLY
Analysis Frame = 40ms
ARTIFACTS at Transitions

4/3/2024 © 2003, JH McClellan & RW Schafer 49


Time-Varying Frequency
 Frequency can change vs. time
 Continuously, not stepped
 FREQUENCY MODULATION (FM)

x(t )  cos( 2 f c t  v(t ))


VOICE
 CHIRP SIGNALS
 Linear Frequency Modulation (LFM)

4/3/2024 © 2003, JH McClellan & RW Schafer 50


New Signal: Linear FM

 Called Chirp Signals (LFM)


QUADRATIC
 Quadratic phase
2
x(t )  A cos( t  2 f 0 t   )
 Freq will change LINEARLY vs. time
 Example of Frequency Modulation (FM)
 Define “instantaneous frequency”

4/3/2024 © 2003, JH McClellan & RW Schafer 51


INSTANTANEOUS FREQ
 Definition
x(t )  A cos( (t ))
Derivative
 i (t )  dt
d  (t )
of the “Angle”

 For Sinusoid:
x(t )  A cos( 2 f 0t   )
 (t )  2 f 0t   Makes sense

 i (t )  dt
d  (t )  2 f
0
4/3/2024 © 2003, JH McClellan & RW Schafer 52
INSTANTANEOUS FREQ
of the Chirp

 Chirp Signals have Quadratic phase


 Freq will change LINEARLY vs. time

x(t )  A cos( t   t   ) 2

  (t )   t   t  2

 i ( t )  d  (t )
dt
 2 t  
4/3/2024 © 2003, JH McClellan & RW Schafer 53
CHIRP SPECTROGRAM

4/3/2024 © 2003, JH McClellan & RW Schafer 55


CHIRP WAVEFORM

4/3/2024 © 2003, JH McClellan & RW Schafer 56


OTHER CHIRPS

 (t) can be anything:

x (t )  A cos( cos(  t )   )
 i (t )  d
dt
 (t )   sin(  t )
 (t) could be speech or music:
 FM radio broadcast

4/3/2024 © 2003, JH McClellan & RW Schafer 57


SINE-WAVE FREQUENCY
MODULATION (FM)

4/3/2024 © 2003, JH McClellan & RW Schafer 58


Solved Problems-1

4/3/2024 © 2003, JH McClellan & RW Schafer 59


Solved Problems-1

4/3/2024 © 2003, JH McClellan & RW Schafer 60


Solved Problems-2

4/3/2024 © 2003, JH McClellan & RW Schafer 61


Solved Problems-2

4/3/2024 © 2003, JH McClellan & RW Schafer 62


Solved Problems-3

4/3/2024 © 2003, JH McClellan & RW Schafer 63


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 64


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 65


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 66


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 67


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 68


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 69


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 70


Solved Problems

4/3/2024 © 2003, JH McClellan & RW Schafer 71


Lecture 6A.
A Brief Overview of Signals

Lets start from the beginning...

1
Continuous-Time (CT) vs. Discrete-Time (DT)

Graphically,
x[n ]
x(t )
... x[3] x[ 2] ...
x[2] x[1]
x[1] x[0]

0 t ... -3 -2 -1 0 1 2 3 4 ... n

(Fig.1.7 Oppenheim)

 It is meaningless to say 3/2th sample of a DT signal because it is not defined.

 The signal values may well also be complex numbers


 (e.g. Phasor of the capacitor voltage in the RC circuit when the input is sinusoidal and R is time
varying)
2
Signal Energy and Power
 In many applications, signals are directly related to physical quantities
capturing power and energy in physical systems
t2


2
 Total energy of a CT signal x(t ) over t1  t  t2 is x(t ) dt
t1 t
1 2


2
 Average power of x(t) (The time average of total energy) is x (t ) dt
(t2  t1 ) t1

n2

 x[n]
2
 Similarly, total energy of a DT signal x[n ] over n1  n  n2 is
n1

 Average power of x[n ] over n1  n  n2 is


n2
1

2
x[n]
(n2  n1  1) n1
3
Signal Energy and Power
 For infinite time intervals:
 Energy: accumulation of absolute of the signal
 T 

 
2 2
E  lim x(t ) dt  x(t ) dt Total energy in CT signal
T  T 
D N 

 
2 2
E  = lim x [n ] = x [n ] Total energy in DT signal
N  n =- N n =-

 Signals with E   are of finite energy

 In order to define the power over infinite intervals we need to take limit of
the average:

T Note: Signals with E  


 1 E

2
P  lim x(t ) dt  lim have P  0
T  2T T  2T
T
N
 1 E

2
P  lim x[ n ]  lim
N  2 N  1 N  2 N  1
n N 4
Signal Energy and Power

 Energy signal iff 0<E<, and so P=0


 e.g:  0, t  0
x(t )   t
e , t  0
 Power signal iff 0<P<, and so E=
 e.g: {x[n]}  ... 1,1, 1,1,1,1...}
 Neither energy nor power, when both E and P are infinite
 e.g: x(t )  et

 Exercise: Calculate power and energy for the above signals

5
Transformation of Independent
Variable

 Sometimes we need to change the independent variable axis


for teoretical analysis or for just practical purposes (both in
CT and DT signals)

 Time shift x[n]  x[n  n0 ]

x(t )  x(t ) (reverse playing of magnetic tape)


 Time reversal
x(t )  x(t / 2) (slow playing, fast playing)
 Time scaling

6
Examples of Transformations
x[n]

Time shift

... ... n

x[n-n0]

........ ... n
n0
If n0 > 0  x[n-n0] is the delayed version of x[n]
(Each point in x[n] occurs later in x[n-n0])
7
Examples of Transformations
x(t)
Time shift

x(t-t0)

t
t0
t0 < 0  x(t-t0) is an advanced version of x(t)

8
Examples of Transformations
x(t)

Time reversal x(-t)

Reflection about t=0

9
Examples of Transformations
x(t)
Time scaling

x(2t)

compressed!
t

x(t/2)

stretched!
t

10
Examples of Transformations
 It is possible to transform the independent variable with a general nonlinear
function h(t) ( we can find x(h(t)))
 However, we are interested in 1st order polynomial transforms of t, i.e., x(t+)
x(t)
1
Given the signal x(t):
t
0 1 2
x(t+1)
Let us find x(t+1): 1

(It is a time shift to the left)


t
-1 0 1
x(-t+1)
1
Let us find x(-t+1):

(Time reversal of x(t+1)) t


-1 0 1
11
Examples of Transformations
For the general case, i.e., x(t+),
1. first apply the shift (),
2. and then perform time scaling (or reversal) based on .
Example: Find x(3t/2+1) x(t+1)
1

t
-1 0 1

x((3/2)t+1)
1

t
12 -2/3 0 2/3
Periodic CT Signals

 A periodic signal satisfies: x(t )  x(t  T ) t , T  0


Example: A CT periodic signal x(t )

 2T T 0
2T
T

 If x(t) is periodic with T then x(t )  x(t  mT ) for m  Z 


 Thus, x(t) is also periodic with 2T, 3T, 4T, ...

 The fundamental period T0 of x(t) is the smallest value of T for which


x(t )  x(t  T ) t , T  0 holds
13
Periodic DT Signals
 A non-periodic signal is called aperiodic.
Period must be
 For DT we must have integer!

x[n  N ]  x[n] n, N  0

Here the smallest N can be 1,  a constant signal

 The smallest positive value N0 of N is the fundamental


period

14
Even and Odd Signals
 If x(t )  x(t ) or x[n]  x[n] even signal (symmetric wrt y-axis)

 If x(t )   x(t ) or x[n]   x[n] odd signal (symmetric wrt origin)

x(t) x(t)
even odd

t t

 Decomposition of signals to even and odd parts:


1
EV x(t )  x(t )  x(t )
2
x(t )  EV x(t ) ODx(t )
1
ODx(t )  x(t )  x(t )
2
15
Exponential and Sinusoidal Signals

 Occur frequently and serve as building blocks to construct many other


signals
 CT Complex Exponential: x(t )  Ce at

where a and C are in general complex.

 Depending on the values of these parameters, the complex exponential


can exhibit several different characteristics
a>0 Real Exponential
a<0
(C and a are real)
x(t) x(t)

C t C
t
16
Exponential and Sinusoidal Signals

 Periodic Complex Exponential (C real, a purely imaginary)


j0t
x(t )  e
 Is this function periodic?
j0t 2πn
x(t )  e  e j0 ( t T )  e j0t .e j0T T n Z 
ω0
for periodicity =1

2
 The fundamental period is T0  
0

 Thus, the signals ejω0t and e-jω0t have the same fundamental
period 17
Exponential and Sinusoidal
Signals

Alternatively,

A cos(0t   )  A Re e j (0t  ) 
A sin(  t   )  A Ime
0
j (0t  )

2
T0 
x(t ) 0

A cos 
CT sinusoidal signal
A cos(0t   )
t

x(t )  A cos(0t   )

19
Exponential and Sinusoidal Signals
 Complex periodic exponential and sinusoidal signals are of infinite
total energy but finite average power
T T0 T T0
j 0 t 2
E period  
T
e dt   1 dt
T
 (T  T0 )  T  T0

1
Pperiod  E period  1
(T  T0 )  T

 As the upper limit of integrand is increased as T  2T0 , T  3T0 ,...E period 

 However, always Pperiod  1 Finite average power!


 Thus, T
1 j 0 t 2
P  lim e dt  1
T  2T
T
20
Harmonically Related Complex Exponentials

 Set of periodic exponentials with fundamental frequencies that are


multiplies of a single positive frequency

xk (t )  e jk0t for k  0,1,2,...


k  0  xk (t ) is a constant
k  0  xk (t ) is periodic with fundamenta l frequency k ω0
2 T0 2
and fundamenta l period  , where T0 
k 0 k 0

 kth harmonic xk(t) is still periodic with T0 as well


 Harmonic (from music): tones resulting from variations in acoustic
pressures that are integer multiples of a fundamental frequency 21
Periodicity Properties of DT
Signals

Periodicit y condition : e jω0(n N)  e jω0n e


jω0 N
(*)
must be unity

This holds if 0 N is an integer multiple of 2 . (**)


In other word s, for some integer m we must have 0 N  2m
0 m
Or equivalent ly  (* * *)
2 N

We have the conditions from (*) and (**) that m and N must be integers.
 m
So DT exp is periodic when 0  is a rational number, not periodic otherwise! !!
2 N

27
Periodicity Properties of DT
Signals

Take the common factor out


2 0
The fundamenta l frequency is then 
N m

 2 
The fundamenta l period is then N  m  (* ***)
 0 

0
Therefore to find the fund. freq. of a complex exp. we need to express as in (* * *)
2
(The same developmen t is also valid for DT sinusoidal signals.)! !

28
Periodicity Properties of DT
Signals: Examples

Ex: x[n]  cos( 2 n )


12
 2 
We use the fundamenta l period formula, N  m  (* * **)
 0 
2 0 1
x[n]  cos( 2 n )  cos(0 n) 0    no factors in common,
12 12 2 12
 12 
so by using (****) , N  1   12 periodic with fund period 12.
1

Ex: x[n]  cos( 4 n )


12
4 0 2 (n  1)
x[n]  cos( 4 n )  cos(0 n) 0     ,
12 12 2 12 ( N  6)
 12 
then using (****) , N  1   6 is periodic with fundamental period 6.
 2 29
Periodicity Properties of DT
Signals: Examples

 Comparison of Periodicity of CT and DT Signals: 0 m



2 N
 Consider x(t) and x[n]

x(t)  cos ( 2πt ) x[n]  cos ( 2πn )


12 12

x(t) is periodic with T=12, x[n] is periodic with N=12.

30
Periodicity Properties of DT
Signals: Examples 0 m
 (* * *)
2 N

 if 
x(t )  cos 8t
31
 and 
x[n]  cos 8n
31
 x(t) is periodic with 31/4.

0 4
 In DT there can be no fractional periods, for x[n] we have 
2 31
then N=31.

 6
If x(t )  cos t and  6
x[n]  cos n
0 1
x(t) is periodic with 12, but x[n] is NOT periodic, because  there is
no way to express it as in (***). 2 12

31
Unit Impulse and Unit Step
Functions (Continuous-Time)
0, t  0 u(t)
CT unit step: u (t )  
1, t  0 t

δ(t)

CT impulse: du (t ) 1 CT unit impulse


 (t )  t is the 1st
dt 0
derivative of the
t
unit sample
u (t )    ( )d CT unit step is the running integral
 of the unit impulse

34
Continuous-Time Impulse
REMARKS:
 Signal of a unit area
 Derivative of unit step function

 Sampling property
x(t ) (t  t0 )  x(t0 ) (t  t0 )
 The integral of product of (t) and (t) equals (0) for
any (t) continuous at the origin and if the interval of
integration includes the origin, i.e.,
t2

  ( ) ( )d
t1
 (0) for t1  0  t 2

35
Unit Impulse and Unit Step
Functions
 Basic signals used to construct and represent other signals
0, n  0 δ[n]
 [ n]   Unit impulse (unit sample)

DT unit impulse: 1, n  0 - - - - - -


n

u[n]
0, n  0
u[n]  
DT unit step: 1, n  0 - - - - - -
n

Relation between DT unit impulse and unit step (?):

 [n]  u[n]  u[n  1]


(DT unit impulse is the first difference of the DT step)
37
Signal Processing First

Lecture 6B
Fourier Series Coefficients

4/3/2024 © 2003, JH McClellan & RW Schafer 38


READING ASSIGNMENTS

 This Lecture:
 Fourier Series in Ch 3, Sects 3-4, 3-5 & 3-6
 Replaces pp. 62-66 in Ch 3 in DSP First
 Notation: ak for Fourier Series

 Other Reading:
 Next Lecture: More Fourier Series

4/3/2024 © 2003, JH McClellan & RW Schafer 39


LECTURE OBJECTIVES
 Work with the Fourier Series Integral
T0
 j ( 2 k / T0 ) t
ak  1
T0 
0
x (t )e dt
 ANALYSIS via Fourier Series
 For PERIODIC signals: x(t+T0) = x(t)
 Later: spectrum from the Fourier Series

4/3/2024 © 2003, JH McClellan & RW Schafer 40


SPECTRUM DIAGRAM

 Recall Complex Amplitude vs. Freq


1 * 10 1
X k  ak
2 X k 7e j / 3
7e  j / 3 2
 j / 2 j / 2
4e jj k
4e
Xk = Ake
–250 –100 0 100 250
f (in Hz)

 
N
x (t )  Xa0   { aXkk e j 2 f k t *  j 2 f k t
1
2
 1
2 aXkk e
k 1
4/3/2024 © 2003, JH McClellan & RW Schafer 41
Jean Baptiste Joseph Fourier
 1807 thesis: “On the Propagation of Heat in Solid Bodies”

Fourier accompanied Napoleon Bonaparte on his Egyptian expedition in 1798, as scientific adviser, and was
appointed secretary of the Institut d'Égypte. Fourier was appointed as Prefect (Governor) of Department of
Isère, Granoble, by Napoleon in 1802 after a brief return to his former position as Professor of Analysis at
the Ecole Polytechnique in Paris.
[Link]
4/3/2024 © 2003, JH McClellan & RW Schafer 42
Harmonic Signal

x (t )   ak e j 2 k f 0 t

k  
PERIOD/FREQUENCY of COMPLEX EXPONENTIAL:

2 1
2  f 0   0  or T0 
T0 f0
[Link]
es_square_wave_circles_animation.svg
4/3/2024 © 2003, JH McClellan & RW Schafer 43
Fourier Series Synthesis


x (t )   ak e j 2 k f 0 t

k  
j k
ak  X k  Ak e
1
2
1
2
N
x (t )  A0   Ak cos(2 kf 0t   k )
k 1
COMPLEX
j k
X k  Ak e AMPLITUDE

4/3/2024 © 2003, JH McClellan & RW Schafer 44


Harmonic Signal (3 Freqs)
a1
a3 a5

T = 0.1

4/3/2024 © 2003, JH McClellan & RW Schafer 45


SYNTHESIS vs. ANALYSIS

 SYNTHESIS  ANALYSIS
 Easy  Hard
 Given (k,Ak,k) create  Given x(t), extract
x(t) (k,Ak,k)
 How many?
 Synthesis can be  Need algorithm for
HARD computer
 Synthesize Speech so that
it sounds good

4/3/2024 © 2003, JH McClellan & RW Schafer 46


STRATEGY: x(t)  ak
 ANALYSIS
 Get representation from the signal
 Works for PERIODIC Signals
 Fourier Series
 Answer is: an INTEGRAL over one period
T0
 j 0k t
ak  1
T0  0
x (t )e dt
4/3/2024 © 2003, JH McClellan & RW Schafer 47
INTEGRAL Property of exp(j)

 INTEGRATE over ONE PERIOD


T0 T0
 j ( 2 / T0 ) mt T0  j ( 2 / T0 ) mt
e dt 
 j 2 m
e
0 0
T0  j 2 m
 (e  1)
 j 2 m
T0
2
e
 j ( 2 / T0 ) mt
dt  0 0 
0 m0 T0
4/3/2024 © 2003, JH McClellan & RW Schafer 48
ORTHOGONALITY of exp(j)

 PRODUCT of exp(+j ) and exp(-j )

1
T0 
 0 k  
j ( 2 / T0 ) t  j ( 2 / T0 ) kt

T0 0
e e dt  
1 k  
T0
1 j ( 2 / T0 )(  k ) t

T0 0
e dt

4/3/2024 © 2003, JH McClellan & RW Schafer 49


Isolate One FS Coefficient

x (t )   ak e j ( 2 / T0 ) k t

k  
T0 T0
  j ( 2 / T0 ) k t   j ( 2 / T0 )  t
  k
 j ( 2 / T0 )  t
1
T0  x (t )e dt  1
T0
 
ak e e

dt
0 0
T0   T0

1
T0  x ( t ) e  j ( 2 / T0 )  t
dt   a k

 T0 
1 e j ( 2 / T0 ) k t
e  j ( 2 / T0 )  t
dt   a

k   
0 0
Integral is zero 
T0
 ak  1
T0  x ( t ) e  j ( 2 / T0 ) k t
dt except for k  
0
4/3/2024 © 2003, JH McClellan & RW Schafer 50
SQUARE WAVE EXAMPLE

1 0  t  12 T0
x (t )  
1T t T
0 2 0 0
for T0  0.04 sec.
x(t)
1

–.02 0 .01 .02 0.04 t


4/3/2024 © 2003, JH McClellan & RW Schafer 51
FS for a SQUARE WAVE {ak}
T0
1  j ( 2 / T0 ) kt
ak   x ( t ) e dt ( k  0)
T0 0
.02
1  j ( 2 / .04 ) kt 
.02

 j ( 2 / .04 ) kt
ak  1 e dt  1
.04 (  j 2 k / .04 )
e
.04 0 0

k
1  j ( ) k 1  ( 1)
 (e  1) 
(  j 2 k ) j 2 k
4/3/2024 © 2003, JH McClellan & RW Schafer 52
DC Coefficient: a0
T0
1  j ( 2 / T0 ) kt
ak   x ( t ) e dt ( k  0)
T0 0
T0
1 1
a0 
T0  x(t )dt  T0 (Area )
0
.02
1 1
a0  
.04 0
1 dt 
.04
(.02  0)  1
2

4/3/2024 © 2003, JH McClellan & RW Schafer 53


Fourier Coefficients ak
 ak is a function of k
 Complex Amplitude for k-th Harmonic
 This one doesn’t depend on the period, T0

 1
 k  1,3,
k j k
1  ( 1) 
ak   0 k  2,4,
j 2 k 
 21 k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 54
Spectrum from Fourier Series
 j
 k k  1,3,
0  2 /(0.04)  2 (25)

ak   0 k  2,4,

 12 k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 55


Example x (t )  sin (3 t ) 3

 j  j 9 t   3 j  j 3 t  3 j   j 3 t   j   j 9 t
x (t )   e  e   e  e
8  8   8   8 
4/3/2024 © 2003, JH McClellan & RW Schafer 56
Example x (t )  sin (3 t ) 3

 j  j 9 t   3 j  j 3 t  3 j   j 3 t   j   j 9 t
x (t )   e  e   e  e
8  8   8  8 
In this case, analysis
just requires picking
off the coefficients.
ak

k  1 k 1
k  3 k 3

4/3/2024 © 2003, JH McClellan & RW Schafer 57


STRATEGY: x(t)  ak
 ANALYSIS
 Get representation from the signal
 Works for PERIODIC Signals
 Fourier Series
 Answer is: an INTEGRAL over one period
T0
 j 0k t
ak  1
T0  0
x (t )e dt
4/3/2024 © 2003, JH McClellan & RW Schafer 58
FS: Rectified Sine Wave {ak}
T0
1
ak   x (t )e  j ( 2 / T0 ) kt dt ( k  1)
T0 0
Half-Wave Rectified Sine
T0 / 2
 j ( 2 / T0 ) kt
ak  1
T0  T
sin( 2
t ) e
0
dt
0
T0 / 2
e j ( 2 / T0 ) t  e  j ( 2 / T0 ) t  j ( 2 / T0 ) kt
 1
T0  2j
e dt
0
T0 / 2 T0 / 2
 1
j 2T0  e  j ( 2 / T0 )( k 1) t dt  1
j 2T0  e  j ( 2 / T0 )( k 1) t dt
0 0

 j ( 2 / T0 )( k 1) t T0 / 2  j ( 2 / T0 )( k 1) t T0 / 2
e e
 j 2T0 (  j ( 2 / T0 )( k 1))
 j 2T0 (  j ( 2 / T0 )( k 1))
4/3/2024 © 2003, JH McClellan & RW Schafer 59
0 0
FS: Rectified Sine Wave
{ak}
 j ( 2 / T0 )( k 1) t T0 / 2  j ( 2 / T0 )( k 1) t T0 / 2
e e
ak  j 2T0 (  j ( 2 / T0 )( k 1))
 j 2T0 (  j ( 2 / T0 )( k 1))
0 0

 1
4 ( k 1)
e  j ( 2 / T0 )( k 1)T0 / 2
 
 1  4 (1k 1) e  j ( 2 / T0 )( k 1)T0 / 2  1
 1
4 ( k 1) e  j ( k 1)
 
 1  4 (1k 1) e  j ( k 1)  1 
 0 k odd
  k 1 ( k 1)
4 ( k 2 1)
 k
 1
 (1)  1   ?j 4  k  1
 1 k even
  ( k 2 1)
4/3/2024 © 2003, JH McClellan & RW Schafer 60
Fourier Series Synthesis
 HOW do you APPROXIMATE x(t) ?
T0
 j ( 2 / T0 ) k t
ak  1
T0  x ( t ) e dt
0
 Use FINITE number of coefficients
N
x (t )   ak e j 2 k f 0 t
ak  ak* when x (t ) is real
k  N
4/3/2024 © 2003, JH McClellan & RW Schafer 61
Fourier Series Synthesis

4/3/2024 © 2003, JH McClellan & RW Schafer 62


Synthesis: 1st & 3rd Harmonics
1 2 2
y (t )   cos(2 ( 25)t  2 ) 
 cos(2 (75)t  2 )
2  3

4/3/2024 © 2003, JH McClellan & RW Schafer 63


Synthesis: up to 7th Harmonic
1 2 2 2 2
y (t )   cos(50 t  2 ) 
 sin(150 t )  sin(250 t )  sin(350 t )
2  3 5 7

4/3/2024 © 2003, JH McClellan & RW Schafer 64


Fourier Synthesis
1 2 2
x N (t )   sin(0t )  sin(30t )  
2  3

4/3/2024 © 2003, JH McClellan & RW Schafer 65


Gibbs’ Phenomenon
 Convergence at DISCONTINUITY of x(t)
 There is always an overshoot
 9% for the Square Wave case

4/3/2024 © 2003, JH McClellan & RW Schafer 66


Fourier Series Demos

 Fourier Series Java Applet


 Greg Slabaugh
 Interactive

 [Link]

 MATLAB GUI: fseriesdemo


 [Link]

4/3/2024 © 2003, JH McClellan & RW Schafer 67


fseriesdemo GUI

4/3/2024 © 2003, JH McClellan & RW Schafer 68


Fourier Series Java Applet

4/3/2024 © 2003, JH McClellan & RW Schafer 70


Selected Problems/Demos 1
……… [Link] cmpe362 …….

x (t )  sin (3 t ) 3
4/3/2024 © 2003, JH McClellan & RW Schafer 72
Selected Problems/Demos 1.1

 j   3 j  j 3 t  3 j   j 3 t   j   j 9 t
x (t )   e j 9 t   e   e  e
8  8   8   8 

4/3/2024 © 2003, JH McClellan & RW Schafer 73


Selected Problems/Demos-1.2

4/3/2024 © 2003, JH McClellan & RW Schafer 74


Selected Problems/Demos-1.3

 j   3 j  j 3 t  3 j   j 3 t   j   j 9 t
4/3/2024
x (t )   e j 9 t  © 2003, JHMcClellan
e & RW e
 Schafer  e 75
8  8   8   8 
Selected Problems/Demos 2.
Determine the Instantaneous Frequency of a Chirp Signal

4/3/2024 © 2003, JH McClellan & RW Schafer 76


Selected Problems/Demos 2.1

4/3/2024 © 2003, JH McClellan & RW Schafer 77


Selected Problems/Demos 3
Work the Linear Chirp backward : determine the signal
given the linear chirp frequencies betweeen T1 and T2

4/3/2024 © 2003, JH McClellan & RW Schafer 78


Selected Problems/Demos 3.1

4/3/2024 © 2003, JH McClellan & RW Schafer 79


Selected Problems/Demos-4
Fourier series coefficients of sum of sinusoids

4/3/2024 © 2003, JH McClellan & RW Schafer 80


Selected Problems/Demos-4.1

4/3/2024 © 2003, JH McClellan & RW Schafer 81


Selected Problems/Demos-5
Fourier series coefficients
for related signals-
linear transformation

4/3/2024 © 2003, JH McClellan & RW Schafer 82


Selected Problems/Demos 5.1

4/3/2024 © 2003, JH McClellan & RW Schafer 83


Selected Problems/Demos 5.2

4/3/2024 © 2003, JH McClellan & RW Schafer 84


Selected Problems/Demos 6.

4/3/2024 © 2003, JH McClellan & RW Schafer 85


Selected Problems/Demos 6.2

4/3/2024 © 2003, JH McClellan & RW Schafer 86


Selected Problems/Demos 7

Study at home:
A-2
B-4
C-5
D-3
E-1

4/3/2024 © 2003, JH McClellan & RW Schafer 87


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 88


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 89


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 90


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 91


Signal Processing First

Lecture 8- (Chapter 4.1-4.5)


Sampling & Aliasing

4/3/2024 © 2003, JH McClellan & RW Schafer 1


Disclaimer

You are recommended to watch the recordings


in addition to studying the coursebook. However,
you are not allowed to copy and share the
recordings anywhere. Since we are not Internet
broadcast presenters (youtubers, online
lecturers) and don't have time to edit the
recordings, you will find numerous mistakes
including tongue slip, pronunciation/
spoken/written/typo errors, etc. Please use the
recordings as is,

4/3/2024 © 2003, JH McClellan & RW Schafer 2


Sampling: x(t) to x[n]
& Aliasing problem
 Sampling is used to convert analog signal x(t) to numbers x[n].

 Sampling is the technique used for recording analog signal information like audio
signals or images by recording their snapshots at periodic time intervals (Ts).

 The sampling frequency, or sampling rate fs is the number of samples taken


per second.

 The Nyquist-Shannon-Kotelnikov sampling theorem states that to restore a


signal, a sufficient sample rate (Nyquist rate) must be greater than twice the
highest frequency of the signal being sampled.

4/3/2024 © 2003, JH McClellan & RW Schafer 3


Sampling & Aliasing
 With images, the highest frequency is related to small structures or
objects like, for example, grass or sand.
 In sounds, the highest frequency is related to higher harmonics produced
by various musical instruments. For example, to reproduce sound in the
human frequency range of 20 Hz to 20 kHz, the sampling frequency must
be higher than 40 kHz.
 For all practical purposes, the sampling rates for:
• Fs CD quality: 41 000 samples/sec.
• Fs of recent smartphones 41000 or 48000 samples/sec
• Fs for PSTN public phones is 8000 samples/sec (the idea back then
was to communicate only not to transfer high quality orchestra sound
!)

4/3/2024 © 2003, JH McClellan & RW Schafer 4


4/3/2024 © 2003, JH McClellan & RW Schafer 5
Sampling & Aliasing
Aliasing is the distortion of the original signal when it is reconstructed from samples
that were taken at the sampling frequency below the Nyquist rate.

Aliasing can be avoided by means of applying low-pass filters or anti-aliasing filters


before sampling.
These filters restrict the signal bandwidth to satisfy the sampling theorem. If a low-
pass filter is not used and the sample rate is below the Nyquist rate, the digital
recording system can actually reconstruct an incorrect frequency.

For example, with the sampling rate of 10 Hz, the 13 Hz sine signal will be converted
into 3 Hz.

4/3/2024 © 2003, JH McClellan & RW Schafer 6


Aliased

Aliased

Antialiased
4/3/2024 © 2003, JH McClellan & RW Schafer 8
LECTURE OBJECTIVES
 SAMPLING can cause ALIASING
 Nyquist/Shannon Sampling Theorem
 Sampling Rate (fs) > 2 fmax(Signal bandwidth)

 Spectrum for digital signals, x[n]


 Normalized Frequency
2f
ˆ  Ts   2
fs ALIASING
4/3/2024 © 2003, JH McClellan & RW Schafer 9
SYSTEMS Process Signals

x(t) y(t)
SYSTEM

 PROCESSING GOALS:
 We need to change x(t) into y(t) for many
engineering applications:
 For example, more BASS, image deblurring,
denoising, etc

4/3/2024 © 2003, JH McClellan & RW Schafer 10


System IMPLEMENTATION
 ANALOG/ELECTRONIC:
 Circuits: resistors, capacitors, op-amps

x(t) y(t)
ELECTRONICS

 DIGITAL/MICROPROCESSOR
 Convert x(t) to numbers stored in memory

x(t) x[n] y[n] y(t)


A-to-D COMPUTER D-to-A

4/3/2024 © 2003, JH McClellan & RW Schafer 11


SAMPLING x(t)
 SAMPLING PROCESS
 Convert x(t) to numbers x[n]
 “n” is an integer; x[n] is a sequence of values
 Think of “n” as the storage address in memory

 UNIFORM SAMPLING at t = nTs


 IDEAL: x[n] = x(nTs)
x(t) x[n]
A-to-D

4/3/2024 © 2003, JH McClellan & RW Schafer 12


SAMPLING RATE, fs
 fs =1/Ts (number of samples/second)
 Eg. Ts = 125 microsec  fs = 8000 samples/sec
• We say the sampling rate is 8000 Hz or 8 KHz

 Uniform Sampling at t = nTs = n/fs


 Sampling intervals are equal, n=0,1,2,3….
 IDEAL: x[n] = x(nTs) = x(n/fs).

x(t) x[n]=x(nTs)
A-to-D

4/3/2024 © 2003, JH McClellan & RW Schafer 13


f  100Hz

f s = 2 kHz

f s = 500Hz

4/3/2024 © 2003, JH McClellan & RW Schafer 14


SAMPLING THEOREM

 HOW OFTEN ?
 DEPENDS on FREQUENCY of SINUSOID
 ANSWERED by NYQUIST/SHANNON/KOTELNIKOV
 ALSO DEPENDS on “RECONSTRUCTION”

4/3/2024 © 2003, JH McClellan & RW Schafer 15


Reconstruction? Which One?
Given the samples, draw a sinusoid through the values

x[n ]  cos(0.4 n ) When n is an integer


cos(0.4 n )  cos(2.4 n )
4/3/2024 © 2003, JH McClellan & RW Schafer 16
DISCRETE-TIME SINUSOID
 Change x(t) into x[n] DERIVATION
x (t )  A cos( t   )
x[n ]  x ( nTs )  A cos( nTs   )
x[n ]  A cos((Ts )n   )
x[n ]  A cos(ˆ n   )
   Ts  f DEFINE DIGITAL FREQUENCY
ˆ 
s
4/3/2024 © 2003, JH McClellan & RW Schafer 18
DIGITAL FREQUENCY ̂
 ̂VARIES from 0 to 2, as f varies from
0 to the sampling frequency
 UNITS are radians, not rad/sec
 DIGITAL FREQUENCY is NORMALIZED

2f
ˆ  Ts 
fs
4/3/2024 © 2003, JH McClellan & RW Schafer 19
SPECTRUM (DIGITAL)
f 1
X
* 1
X
ˆ  2 2 2

fs
f s  1 kHz –2 2 wˆ
x[n ]  A cos(2 (100)( n / 1000)   )

4/3/2024 © 2003, JH McClellan & RW Schafer 20


SPECTRUM (DIGITAL)
f 1
X
* 1
X
wˆ = 2 p 2 2

fs
f s = 100 Hz –2 2 wˆ
x[n ]  A cos(2 (100)( n / 100)   )

4/3/2024 © 2003, JH McClellan & RW Schafer 21


A Nice Demo

[Link]
Q

4/3/2024 © 2003, JH McClellan & RW Schafer 22


The REST of the STORY

 Spectrum of x[n] has more than one line for


each complex exponential
 Called ALIASING
 MANY SPECTRAL LINES

 SPECTRUM is PERIODIC with period = 2


 Because

A cos(wˆ n + j ) = A cos((wˆ + 2p )n + j )
4/3/2024 © 2003, JH McClellan & RW Schafer 23
ALIASING DERIVATION
 Other Frequencies give the same wˆ
x1 (t )  cos(400 t ) sampled at f s  1000 Hz
x1[n ]  cos(400 1000
n
)  cos(0.4 n )
x2 (t )  cos(2400 t ) sampled at f s  1000 Hz
x2 [n ]  cos(2400 1000
n
)  cos(2.4 n )

x2 [n ]  cos(2.4 n )  cos(0.4 n  2 n )  cos(0.4 n )


 x2 [n ]  x1[n ] 2400  400  2 (1000)
4/3/2024 © 2003, JH McClellan & RW Schafer 24
ALIASING DERIVATION–2
 Other Frequencies give the same wˆ
n
t ¬
fs
and we want : x[n] = Acos(wˆ n + j )
2 ( f  f s ) 2 f 2 f s
then : ˆ   
fs fs fs
2 f
ˆ  Ts   2 
4/3/2024 fs
© 2003, JH McClellan & RW Schafer 25
SPECTRUM (MORE LINES)
f 1
X 1
X
* 1
X 1
X
*
ˆ  2 2 2 2 2
fs
–1.8 –2 2 1.8

f s  1 kHz
x[n ]  A cos(2 (100)( n / 1000)   )

4/3/2024 © 2003, JH McClellan & RW Schafer 26


SPECTRUM (ALIASING CASE)
* 1 * 1 * 1
f
1
2 X 2 X 1
X 2 X 1
X 2 X
ˆ  2 2 2
fs

–2.5 –1.5 –0.5 0.5 1.5 2.5



fs = 80 Hz
x[n ]  A cos(2 (100)( n / 80)   )

4/3/2024 © 2003, JH McClellan & RW Schafer 27


SAMPLING GUI (con2dis)

4/3/2024 © 2003, JH McClellan & RW Schafer 28


FOLDING (a type of ALIASING)

 MANY x(t) give IDENTICAL x[n]


 CAN’T TELL fo FROM (fs-fo)
 Or, (2fs-fo ) or, (3fs-fo )
 EXAMPLE:
 y(t) has 1000 Hz component
 SAMPLING FREQ = 1500 Hz
 WHAT is the “FOLDED” ALIAS ?
-1000 +1500  500
4/3/2024 © 2003, JH McClellan & RW Schafer 29
FOLDING (a type of ALIASING)
 EXAMPLE: 3 different x(t); same x[n]
100
f s  1000 ˆ  2  2 (0.1)
1000
cos(2 (100)t )  cos[2 (0.1)n ]
cos(2 (1100)t )  cos[2 (1.1)n ]  cos[2 (0.1)n ]
cos(2 (900)t )  cos[2 (0.9)n ]
 cos[2 (0.9)n  2 n ]  cos[2 ( 0.1)n ]  cos[2 (0.1)n ]

 900 Hz “folds” to 100 Hz when fs=1kHz


4/3/2024 © 2003, JH McClellan & RW Schafer 30
SPECTRUM (FOLDING CASE)
* 1 * 1
f 1
X 2 X 1
X 2 X
wˆ = 2 p 2 2
fs

f s = 125Hz –1.6 –0.4 0.4 1.6



x[n ]  A cos(2 (100)( n / 125)   )

4/3/2024 © 2003, JH McClellan & RW Schafer 31


Signal Processing First

Lecture 9- (Ch 4.4-4.5)


D-to-A Conversion

4/3/2024 © 2003, JH McClellan & RW Schafer 35


LECTURE OBJECTIVES
 DIGITAL-to-ANALOG CONVERSION is
 Reconstruction from samples
 SAMPLING THEOREM applies
 Smooth Interpolation
 Mathematical Model of D-to-A
 SUM of SHIFTED PULSES
 Linear Interpolation example

4/3/2024 © 2003, JH McClellan & RW Schafer 36


SIGNAL TYPES

x(t) x[n] y[n] y(t)


A-to-D COMPUTER D-to-A

 A-to-D
 Convert x(t) to numbers stored in memory
 D-to-A
 Convert y[n] back to a “continuous-time” signal,
y(t)
 y[n] is called a “discrete-time” signal

4/3/2024 © 2003, JH McClellan & RW Schafer 37


D-to-A Reconstruction
x(t) x[n] y[n] y(t)
A-to-D COMPUTER D-to-A

 Create continuous y(t) from y[n]


 IDEAL
 If you have formula for y[n]
 Replace n in y[n], n= fst
 y[n] = Acos(0.2n+) with fs = 8000 Hz
 y(t) = Acos(2(800)t+)
4/3/2024 © 2003, JH McClellan & RW Schafer 38
D-to-A

 Given y[n], which y(t) do we pick ? ? ?


 infinite number of y(t)
 passing thru the samples, y[n]
 D-to-A reconstruction must choose one output

 Reconstruct the smoothest one


 the lowest freq, if y[n] = sinusoid

4/3/2024 © 2003, JH McClellan & RW Schafer 39


Reconstruction (D-to-A)

 CONVERT STREAM of NUMBERS to x(t)


 “CONNECT THE DOTS”
 INTERPOLATION INTUITIVE,
conveys the idea
y[k]

y(t)

t
kTs (k+1)Ts

4/3/2024 © 2003, JH McClellan & RW Schafer 40


SAMPLE & HOLD CIRCUIT

 CONVERT y[n] to y(t)


 y[k] should be the value of y(t) at t = kTs
 Make y(t) equal to y[k] for
 kTs -0.5Ts < t < kTs +0.5Ts

y[k] STAIR-STEP
y(t) APPROXIMATION

t
kTs (k+1)Ts

4/3/2024 © 2003, JH McClellan & RW Schafer 41


SQUARE PULSE CASE

4/3/2024 © 2003, JH McClellan & RW Schafer 42


OVER-SAMPLING CASE

EASIER TO RECONSTRUCT

4/3/2024 © 2003, JH McClellan & RW Schafer 43


MATH MODEL for D-to-A

SQUARE PULSE:

4/3/2024 © 2003, JH McClellan & RW Schafer 44


EXPAND the SUMMATION
¥

å y[n]p(t - nT ) =
n= - ¥
s

+ y[0]p(t) + y[1]p(t - Ts ) + y[2]p(t - 2Ts ) +


 SUM of SHIFTED PULSES p(t-nTs)
 “WEIGHTED” by y[n]
 CENTERED at t=nTs
 SPACED by Ts
 RESTORES “REAL TIME”

4/3/2024 © 2003, JH McClellan & RW Schafer 45


p(t)

4/3/2024 © 2003, JH McClellan & RW Schafer 46


TRIANGULAR PULSE (2X)

4/3/2024 © 2003, JH McClellan & RW Schafer 47


OPTIMAL PULSE

CALLED
“BANDLIMITED
INTERPOLATION”

t
sin Ts
p (t )  t
for    t  
Ts
p(t )  0 for t  Ts ,  2Ts ,
4/3/2024 © 2003, JH McClellan & RW Schafer 48
PRACTICAL PULSE
USING AWGN-Gaussian Noise
1st,2nd, 3rd, 4 deriative of Gaussian
a first derivative using the 2-point central-difference method, deriv1, an unsmoothed first derivative using adjacent differences,
deriv2, a second derivative using the 3-point central-difference method,
a third derivative deriv3 using a 4-point formula, and deriv4, a 4th derivative using a 5-point formula.

[Link]

function d=deriv1(a)
% First derivative of vector using simple adjacent differences.
% Example: deriv([1 1 1 2 3 4]) returns [0 0 0 1 1 1]
% T. C. O'Haver, 2013.
n=length(a);
d=zeros(size(a));
d(1)=a(2)-a(1);
for j = 2:n;
d(j)=a(j)-a(j-1);
end
4/3/2024 © 2003, JH McClellan & RW Schafer 49
PRACTICAL PULSE
USING AWGN-Gaussian Noise
1st,2nd, 3rd, 4 deriative of Gaussian
a first derivative using the 2-point central-difference method, deriv1, an unsmoothed first derivative using adjacent differences,
deriv2, a second derivative using the 3-point central-difference method,
a third derivative deriv3 using a 4-point formula, and deriv4, a 4th derivative using a 5-point formula.

[Link]

function d=deriv1(a)
% First derivative of vector using simple adjacent differences.
% Example: deriv([1 1 1 2 3 4]) returns [0 0 0 1 1 1]
% T. C. O'Haver, 2013.
n=length(a);
d=zeros(size(a));
d(1)=a(2)-a(1);
for j = 2:n;
d(j)=a(j)-a(j-1);
end
4/3/2024 © 2003, JH McClellan & RW Schafer 50
Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 51


Selected Problems/Demos
 Show that the signal 7 cos(9.6πn + 0.2π) is an alias of the signal 7 cos(0.4πn − 0.2π).

Check! Depict MATLAB plots of these two signals to verify that the phase must change sign
to have identical plots?
4/3/2024 © 2003, JH McClellan & RW Schafer 52
Selected Problems/Demos
Sampling & aliasing given continuous-time spectrum

4/3/2024 © 2003, JH McClellan & RW Schafer 53


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 54


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 55


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 56


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 57


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 58


Selected Problems/Demos

 Visit moodle for excellent materials:


 Smapling MATLAB demo by Veyis
 PS 2021 by Tuluhan
 MATLAB workshop by Emre

4/3/2024 © 2003, JH McClellan & RW Schafer 60


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 61


cmpe 362- Signal Processing
(Covid Break-RECAP)

Instructor: Prof. Dr. Fatih Alagöz

TA: Mete Tuluhan Akbulut

Student Asistant: Adalet Veyis Turgut


Signal processing everywhere
x(n) or x(t) SYSTEM y(n) or y(t)
(PROCESS)
INPUT SIGNAL OUTPUT SIGNAL

 Audio, speech, image, video


 Ranging from nanoscale to deepspace communications
 Sonar, radar, geosensing
 Array processing,
 Control systems (all industry)
 Seismology,
 Meteorology,
 Finance, Health, Security, just name it!! BIG DATA, YES!
NOISY DATA: YES!
IN SHORT: IT IS GOOD TO KNOW THIS COURSE 2
SINUSOIDAL SIGNAL

Acos(w t + j )
 FREQUENCY
 Radians/sec
w  AMPLITUDE
A
 Magnitude
 Hertz (cycles/sec)

w = (2p ) f
 PERIOD (in sec)
1 2p
 PHASE
j
T= =
4/3/2024 f w 2003 rws/jMc 4
SINUSOID from a PLOT

 Measure the period, T


 Between peaks or zero crossings
3 steps
 Compute frequency:  = 2/T
 Measure time of a peak: tm
 Compute phase:  = -tm
 Measure height of positive peak: A

4/3/2024 © 2003, JH McClellan & RW Schafer 5


*** COMPLEX NUMBERS **

 Vector Form
 Length =1
 Angle = 
 Common Values
 j has angle of 0.5
 1 has angle of 
  j has angle of 1.5
 also, angle of j could be 0.51.52

4/3/2024 © 2003, JH McClellan & RW Schafer 6


Euler’s FORMULA

 Complex Exponential
 Real part is cosine
 Imaginary part is sine
 Magnitude is one
j
e  cos( )  j sin( )
j
re  r cos( )  jr sin( )
4/3/2024 © 2003, JH McClellan & RW Schafer 7
COMPLEX AMPLITUDE
General Sinusoid
x(t )  A cos( t   )  e Ae e  j j t

Complex AMPLITUDE = X
j t j
z (t )  Xe X  Ae
Then, any Sinusoid = REAL PART of Xejt

x(t )  e Xe j t
 eAe j
e j t

4/3/2024 © 2003, JH McClellan & RW Schafer 8
Spectrum Representation

 Sinusoids with DIFFERENT Frequencies


 SYNTHESIZE by Adding Sinusoids
N
x (t )   Ak cos(2 f k t   k )
k 1
 SPECTRUM Representation
 Graphical Form shows DIFFERENT Freqs

4/3/2024 © 2003, JH McClellan & RW Schafer 9


FREQUENCY DIAGRAM

 Plot Complex Amplitude vs. Freq

10
j / 3  j / 3
7e 7e
 j / 2 j / 2
4e 4e

–250 –100 0 100 250


f (in Hz)

4/3/2024 © 2003, JH McClellan & RW Schafer 10


Add Spectrum Components-1
 Frequencies:  Amplitude & Phase
 -250 Hz  4 -/2
 -100 Hz  7 +/3
 0 Hz  10 0
 100 Hz  7 -/3
 4 +/2
 250 Hz

x (t )  10 
 j / 3 j 2 (100) t j / 3  j 2 (100) t
7e e  7e e
j / 2 j 2 ( 250) t  j / 2  j 2 ( 250) t
4e e  4e e
4/3/2024 © 2003, JH McClellan & RW Schafer 11
Fourier Series:
LECTURE OBJECTIVES
 Work with the Fourier Series Integral
T0
 j ( 2 k / T0 ) t
ak  1
T0 
0
x (t )e dt
 ANALYSIS via Fourier Series
 For PERIODIC signals: x(t+T0) = x(t)
 Later: spectrum from the Fourier Series

4/3/2024 © 2003, JH McClellan & RW Schafer 12


SQUARE WAVE EXAMPLE

1 0  t  12 T0
x (t )  
1T t T
0 2 0 0
for T0  0.04 sec.
x(t)
1

–.02 0 .01 .02 0.04 t


4/3/2024 © 2003, JH McClellan & RW Schafer 13
FS for a SQUARE WAVE {ak}
T0
1  j ( 2 / T0 ) kt
ak 
T0  x (t )e dt ( k  0)
0

.02
1  j ( 2 / .04 ) kt 
.02

 j ( 2 / .04 ) kt
ak  1 e dt  1
.04 (  j 2 k / .04 )
e
.04 0 0

k
1  j ( ) k 1  ( 1)
 (e  1) 
(  j 2 k ) j 2 k
4/3/2024 © 2003, JH McClellan & RW Schafer 14
Spectrum from Fourier Series
 j
 k k  1,3,
0  2 /(0.04)  2 (25)

ak   0 k  2,4,

 12 k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 15


Fourier Series Synthesis

4/3/2024 © 2003, JH McClellan & RW Schafer 16


SAMPLING THEOREM

 HOW OFTEN ?
 DEPENDS on FREQUENCY of SINUSOID
 ANSWERED by NYQUIST/SHANNON/KONELIKOV
 ALSO DEPENDS on “RECONSTRUCTION”

4/3/2024 © 2003, JH McClellan & RW Schafer 17


OPTIMAL PULSE

CALLED
“BANDLIMITED
INTERPOLATION”

t
sin Ts
p (t )  t
for    t  
Ts
p(t )  0 for t  Ts ,  2Ts ,
4/3/2024 © 2003, JH McClellan & RW Schafer 18
Signal Processing First

Filtering Intro

Lecture 10- (Chapter 5)

4/3/2024 © 2003, JH McClellan & RW Schafer 19


Signal Processing First

You are recommended to watch the recordings in


addition to studying the coursebook. However, you are
not allowed to copy and share the recordings anywhere.
Since we are not Internet broadcast presenters
(youtubers, online lecturers) and don't have time to edit
the recordings, you will find numerous mistakes
including tongue slip, pronunciation/ spoken/written/typo
errors, etc. Please use the recordings as is…

4/3/2024 © 2003, JH McClellan & RW Schafer 20


LECTURE OBJECTIVES

 INTRODUCE FILTERING IDEA


 Weighted Average
 Running Average
 FINITE IMPULSE RESPONSE FILTERS
 FIR Filters
 Show how to compute the output y[n] from
the input signal, x[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 21


DIGITAL FILTERING

x(t) x[n] y[n] y(t)


A-to-D COMPUTER D-to-A

 Concentrate on the computer (digital signal processor)


 Processing algorithms typically require a large number of
mathematical operations to be performed quickly and
repeatedly on a series of data samples
 Software (Matlab)
 HARDWARE: DSP chips, VLSI

4/3/2024 © 2003, JH McClellan & RW Schafer 22


Rockland Digital Filter, 1971

For the price of a small house, you could have one of these.

4/3/2024 © 2003, JH McClellan & RW Schafer 23


Digital Cell Phone (ca. 2000)

4/3/2024
Now it plays video
© 2003, JH McClellan & RW Schafer 24
FILTERED STOCK SIGNAL

INPUT

OUTPUT

4/3/2024 © 2003, JH McClellan & RW Schafer


50-pt Averager
25
Moore’s Law for TI DSPs

LOG SCALE

Double every
18 months ?

4/3/2024 © 2003, JH McClellan & RW Schafer 26


Moore’s Law for TI DSPs

Double every
18 months ?

4/3/2024 © 2003, JH McClellan & RW Schafer 27


SIMPLE SYSTEM EXAMPLES

x[n] y[n]
SYSTEM

EX.1: Simple Multiplier, y[n] = 5 x[n]

EX.2: Running Average


 “the output at time n is the average of consecutive inputs”
assume, y[n] = (x[n]+x[n-1])/2

 EX.3: Pointwise operator, Squaring, y[n] = (x[n])2

4/3/2024 © 2003, JH McClellan & RW Schafer 28


DISCRETE-TIME SIGNAL

 x[n] is a LIST of NUMBERS


 INDEXED by “n”


4/3/2024
Fig.5.2 © 2003, JH McClellan & RW Schafer 29
3-PT AVERAGE SYSTEM
 ADD 3 CONSECUTIVE NUMBERS
 Do this for each “n”
Make a TABLE

y[n ]  13 ( x[n ]  x[n  1]  x[n  2])

n=0

4/3/2024 n=1
© 2003, JH McClellan & RW Schafer 30
INPUT SIGNAL

y[n ]  13 ( x[n ]  x[n  1]  x[n  2])

OUTPUT SIGNAL

4/3/2024 © 2003, JH McClellan & RW Schafer 31


PAST, PRESENT, FUTURE

“n” is TIME

4/3/2024 © 2003, JH McClellan & RW Schafer 32


ANOTHER 3-pt AVERAGER
 Uses “PAST” VALUES of x[n]

y[n ]  13 ( x[n ]  x[n  1]  x[n  2])

4/3/2024 © 2003, JH McClellan & RW Schafer 33


GENERAL FIR FILTER
 FILTER COEFFICIENTS {bk}
 DEFINE THE FILTER M
y[n ]   bk x[n  k ]
k 0

 For example, bk  {3,  1, 2,1}


3
y[n ]   bk x[n  k ]
k 0
 3x[n ]  x[n  1]  2 x[n  2]  x[n  3]
4/3/2024 © 2003, JH McClellan & RW Schafer 34
GENERAL FIR FILTER
 FILTER COEFFICIENTS {bk}
M
y[n ]   bk x[n  k ]
k 0
 FILTER ORDER is M
 FILTER LENGTH is L = M+1
 NUMBER of FILTER COEFFS is L

4/3/2024 © 2003, JH McClellan & RW Schafer 35


Signal Processing First

Linearity & Time-Invariance


Convolution

Lecture 11-Chapter5

4/3/2024 © 2003, JH McClellan & RW Schafer 36


LECTURE OBJECTIVES
 GENERAL PROPERTIES of FILTERS
 LINEARITY LTI SYSTEMS
 TIME-INVARIANCE
 ==> CONVOLUTION

 BLOCK DIAGRAM REPRESENTATION


 Components for Hardware
 Connect Simple Filters Together to Build More
Complicated Systems

4/3/2024 © 2003, JH McClellan & RW Schafer 37


OVERVIEW
 IMPULSE RESPONSE: h[n ]
 Definition: Reaction of dynamic system in response to some external change

FIR case: same as {bk }

 CONVOLUTION y[n ]  h[n ]  x[n ]


 GENERAL CLASS of SYSTEMS
 LINEAR and TIME-INVARIANT
 ALL LTI systems have h[n] & use convolution

4/3/2024 © 2003, JH McClellan & RW Schafer 38


DIGITAL FILTERING CONCEPT

x(t) x[n] y[n] y(t)


A-to-D FILTER D-to-A

 CONCENTRATE on the FILTER (DSP)


 DISCRETE-TIME SIGNALS
 FUNCTIONS of n, the “time index”
 INPUT x[n]
 OUTPUT y[n]
4/3/2024 © 2003, JH McClellan & RW Schafer 39
COMPLICATED FILTERS

x[n] OUTPUT y[n]


+
FILTER FILTER
INPUT +

FILTER

 BUILD UP COMPLICATED FILTERS


 FROM SIMPLE MODULES
 Ex: FILTER MODULE MIGHT BE 3-pt FIR

4/3/2024 © 2003, JH McClellan & RW Schafer 40


GENERAL FIR FILTER
 FILTER COEFFICIENTS {bk}
 DEFINE THE FILTER M
y[n ]   bk x[n  k ]
k 0
 For example, bk  {3,  1, 2,1}
3
y[n ]   bk x[n  k ]
k 0
 3x[n ]  x[n  1]  2 x[n  2]  x[n  3]
4/3/2024 © 2003, JH McClellan & RW Schafer 41
MATLAB for FIR FILTER
 yy = conv(bb,xx)
 VECTOR bb contains Filter Coefficients
 DSP-First: yy = firfilt(bb,xx)

 FILTER COEFFICIENTS {bk} conv2()


M for images

y[n ]   bk x[n  k ]
k 0
4/3/2024 © 2003, JH McClellan & RW Schafer 42
SPECIAL INPUT SIGNALS

 Next lecture: x[n] = SINUSOID FREQUENCY RESPONSE


 x[n] has only one NON-ZERO VALUE

1 n  0
 [n ]  
0 n  0
UNIT-IMPULSE
1

n
4/3/2024 © 2003, JH McClellan & RW Schafer 43
FIR IMPULSE RESPONSE

 Convolution = Filter Definition


 Filter Coeffs = Impulse Response

M M
h[n ]   bk [n  k ] y[n ]   bk x[n  k ]
k 0 k 0
4/3/2024 © 2003, JH McClellan & RW Schafer 44
MATH FORMULA for h[n]

 Use SHIFTED IMPULSES to write h[n]


h[n ]   [n ]   [n  1]  2 [n  2]   [n  3]   [n  4]
2
h[n ]
1

0 4 n

–1
bk  { 1,  1, 2,  1, 1 }
4/3/2024 © 2003, JH McClellan & RW Schafer 45
LTI: Convolution Sum
 Output = Convolution of x[n] & h[n]
 NOTATION: y[n ]  h[n ]  x[n ]
 Here is the FIR case:
FINITE LIMITS

M
y[n ]   h[k ] x[n  k ]
k 0
Same as bk FINITE LIMITS
4/3/2024 © 2003, JH McClellan & RW Schafer 46
CONVOLUTION Example
h[n ]   [n ]   [n  1]  2 [n  2]   [n  3]   [n  4]
x[n ]  u[n ]

h[0] x[n ]
h[1] x[n  1]
h[2] x[n  2]
h[3] x[n  3]
h[4] x[n  4]
4/3/2024 © 2003, JH McClellan & RW Schafer 47
GENERAL FIR FILTER
 SLIDE a Length-L WINDOW over x[n]

x[n-M] x[n]
4/3/2024 © 2003, JH McClellan & RW Schafer 48
DCONVDEMO: MATLAB GUI

4/3/2024 © 2003, JH McClellan & RW Schafer 49


Ex-POP QUIZ
 FIR Filter is “FIRST DIFFERENCE”
 y[n] = x[n] - x[n-1]
 INPUT is “UNIT STEP”
1 n  0
u[n ]  
0 n  0

 Find y[n]
y[n ]  u[n ]  u[n  1]   [n ]
4/3/2024 © 2003, JH McClellan & RW Schafer 50
HARDWARE STRUCTURES

x[n] y[n] M
FILTER y[n ]   bk x[n  k ]
k 0

 INTERNAL STRUCTURE of “FILTER”


 WHAT COMPONENTS ARE NEEDED?
 HOW DO WE “HOOK” THEM TOGETHER?
 SIGNAL FLOW GRAPH NOTATION

4/3/2024 © 2003, JH McClellan & RW Schafer 51


HARDWARE ATOMS
 Add, Multiply & Store M
y[n ]   bk x[n  k ]
k 0

y[n ]  x1[n ]  x2 [n ]
y[n ]   x[n ]

4/3/2024
y[n ]  x[n  1]
© 2003, JH McClellan & RW Schafer 52
FIR STRUCTURE

 Direct Form M
y[n ]   bk x[n  k ]
SIGNAL
FLOW GRAPH k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 53


Alternative FIR Structure
Direct form Transposed form

M
y[n ]   bk x[n  k ]
k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 54


SYSTEM PROPERTIES

x[n] y[n]
SYSTEM

 MATHEMATICAL DESCRIPTION
 TIME-INVARIANCE
 LINEARITY
 CAUSALITY
 “No output prior to input”

4/3/2024 © 2003, JH McClellan & RW Schafer 55


TIME-INVARIANCE

 IDEA:
 “Time-Shifting the input will cause the same
time-shift in the output”

 EQUIVALENTLY,
 We can prove that
 The time origin (n=0) is picked arbitrary

4/3/2024 © 2003, JH McClellan & RW Schafer 56


TESTING Time-Invariance

4/3/2024 © 2003, JH McClellan & RW Schafer 57


LINEAR SYSTEM

 LINEARITY = Two Properties


 SCALING
 “Doubling x[n] will double y[n]”

 SUPERPOSITION:
 “Adding two inputs gives an output that is the
sum of the individual outputs”

4/3/2024 © 2003, JH McClellan & RW Schafer 58


TESTING LINEARITY

4/3/2024 © 2003, JH McClellan & RW Schafer 59


LTI SYSTEMS

 LTI: Linear & Time-Invariant


 COMPLETELY CHARACTERIZED by:
 IMPULSE RESPONSE h[n]
 CONVOLUTION: y[n] = x[n]*h[n]
 The “rule”defining the system can ALWAYS be re-
written as convolution
 FIR Example: h[n] is same as bk

4/3/2024 © 2003, JH McClellan & RW Schafer 60


Ex-POP QUIZ
 FIR Filter is “FIRST DIFFERENCE”
 y[n] = x[n] - x[n -1]
 Write output as a convolution
 Need impulse response
h[n ]   [n ]   [n  1]
 Then, another way to compute the output:

y[n ]   [n ]   [n  1]  x[n ]

4/3/2024 © 2003, JH McClellan & RW Schafer 61


CASCADE SYSTEMS

 Does the order of S1 & S2 matter?


 NO, LTI SYSTEMS can be rearranged !!!
 WHAT ARE THE FILTER COEFFS? {bk}

S1 S2

4/3/2024 © 2003, JH McClellan & RW Schafer 62


CASCADE EQUIVALENT
 Find “overall” h[n] for a cascade ?

S1 S2

S2 S1
4/3/2024 © 2003, JH McClellan & RW Schafer 63
CONVOLUTION Example

4/3/2024 © 2003, JH McClellan & RW Schafer 64


SPECIAL INPUT SIGNALS

 x[n] has only one NON-ZERO VALUE

1 n  0
 [n ]  
0 n  0
UNIT-IMPULSE
1

n
4/3/2024 © 2003, JH McClellan & RW Schafer 65
UNIT IMPULSE SIGNAL [n]

n3
[n] is NON-ZERO  [n  3]
When its argument
is equal to ZERO

4/3/2024 © 2003, JH McClellan & RW Schafer 66


MATH FORMULA for x[n]

 Use SHIFTED IMPULSES to write x[n]


x[n ]  2 [n ]  4 [n  1]  6 [n  2]  4 [n  3]  2 [n  4]

4/3/2024 © 2003, JH McClellan & RW Schafer 67


SUM of SHIFTED IMPULSES

This formula ALWAYS works

4/3/2024 © 2003, JH McClellan & RW Schafer 68


4-pt AVERAGER
 CAUSAL SYSTEM: USE PAST VALUES
y[n ]  14 ( x[n ]  x[n  1]  x[n  2]  x[n  3])

 INPUT = UNIT IMPULSE SIGNAL = [n]


x[n ]   [n ]
y[n ]  14  [n ]  14  [n  1]  14  [n  2]  14  [n  3]
 OUTPUT is called “IMPULSE RESPONSE”
h[n ]  { , 0, 0, 14 , 14 , 14 , 14 , 0, 0, }
4/3/2024 © 2003, JH McClellan & RW Schafer 69
FIR IMPULSE RESPONSE
 Convolution = Filter Definition
 Filter Coeffs = Impulse Response

M M
y[n ]   bk x[n  k ] y[n ]   h[k ] x[n  k ]
k 0 k 0
CONVOLUTION
4/3/2024 © 2003, JH McClellan & RW Schafer 71
FILTERING EXAMPLES

6
y7 [n ]   17 x[n  k ]
 7-point AVERAGER k 0
 Smooth compared to 3-point Averager
 By making its amplitude (A) smaller
2
y3[n ]   13 x[n  k ]
 3-point AVERAGER
 Changes A slightly
k 0

4/3/2024 © 2003, JH McClellan & RW Schafer 72


3-pt AVG EXAMPLE
Input : x[n ]  (1.02)n  cos(2 n / 8   / 4) for 0  n  40

USE PAST VALUES

4/3/2024 © 2003, JH McClellan & RW Schafer 73


7-pt FIR EXAMPLE (AVG)
Input : x[n ]  (1.02)n  cos(2 n / 8   / 4) for 0  n  40

CAUSAL: Use Previous

4/3/2024 © 2003, JH McClellan & RW Schafer 74


LONGER OUTPUT
Selected Problems/Demos

 Visit moodle for excellent materials:


 MATLAB demo by Veyis
 PS 2021 by Tuluhan
 And attend the Matlab session given by
Emre

4/3/2024 © 2003, JH McClellan & RW Schafer 75


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 76


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 77


FILTERING EXAMPLE

4/3/2024 © 2003, JH McClellan & RW Schafer 78


FILTERING EXAMPLE-
SOLUTION

4/3/2024 © 2003, JH McClellan & RW Schafer 79


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 81


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 82


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 83


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 84


4/3/2024 © 2003, JH McClellan & RW Schafer 85
Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 86


4/3/2024 © 2003, JH McClellan & RW Schafer 87
Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 88


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 89


4/3/2024 © 2003, JH McClellan & RW Schafer 90
Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 91


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 92


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 93


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 94


Signal Processing First
Lecture 12
Frequency Response
of FIR Filters

4/3/2024 © 2003, JH McClellan & RW Schafer 1


Signal Processing First

You are recommended to watch the recordings in


addition to studying the textbook. However, you are not
allowed to copy and share the recordings anywhere.
Since we are not Internet broadcast presenters
(youtubers, online lecturers) and don't have time to edit
the recordings, you will find numerous mistakes
including tongue slip, pronunciation/ spoken/written/typo
errors, etc. Please use the recordings as is…

4/3/2024 © 2003, JH McClellan & RW Schafer 2


SIMPLE IDEA
if input is sinusoidal, use Digital Frequency domain

 Time domain
x[n]
h[n] y[n]

 Digital Frequency domain


x[n] y[n]
j̂
H (e )
wˆ ̂
4/3/2024 © 2003, JH McClellan & RW Schafer 3
READING ASSIGNMENTS

 This Lecture:
 Chapter 6, Sections 6-1, 6-2, 6-3, 6-4, & 6-5

 Other Reading:
 Recitation: Chapter 6
 FREQUENCY RESPONSE EXAMPLES
 Next Lecture: Chap. 6, Sects. 6-6, 6-7 & 6-8

4/3/2024 © 2003, JH McClellan & RW Schafer 4


LECTURE OBJECTIVES
 SINUSOIDAL INPUT SIGNAL
 DETERMINE the FIR FILTER OUTPUT

MAG
 FREQUENCY RESPONSE of FIR
PHASE
 PLOTTING vs. Frequency
 MAGNITUDE vs. Freq jˆ jˆ jH ( e jˆ )
 PHASE vs. Freq H (e )  H (e ) e
• Sinusoid IN ------ (LTI) ---> Sinusoid OUT
At the SAME Frequency
4/3/2024 © 2003, JH McClellan & RW Schafer 5
DOMAINS: Time & Frequency

 Time-Domain: “n” = time


 x[n] discrete-time signal
 x(t) continuous-time signal

 Frequency Domain (sum of sinusoids)


 Spectrum vs. f (Hz)
• ANALOG vs. DIGITAL
 Spectrum vs. omega-hat

4/3/2024 © 2003, JH McClellan & RW Schafer 6


COMPLEX EXPONENTIAL
j jˆ n
x[n ]  Ae e n
x[n] is the input signal—a complex exponential

M M
y[n]   bk x[n  k ]   h[k ]x[n  k ]
k 0 k 0
FIR DIFFERENCE EQUATION

4/3/2024 © 2003, JH McClellan & RW Schafer 7


COMPLEX EXP OUTPUT
 Use the FIR “Difference Equation”
j jˆ n
Let x[n]  Ae e
M M
y[n]   bk x[n  k ]   bk Ae j e jˆ ( nk )
k 0 k 0

M jˆ (  k ) 
   bk e
  j jˆ n
 Ae e
 k 0 
j jˆ n
 H (ˆ ) Ae e
4/3/2024 © 2003, JH McClellan & RW Schafer 8
FREQUENCY RESPONSE
 At each frequency, we can DEFINE
M M
H (e )   bk e
jˆ  jˆ k
H (ˆ )   bk e  jˆ k

k 0 k 0

 Complex-valued formula
 Has MAGNITUDE vs. frequency
 And PHASE vs. frequency
 Notation: H ( e jˆ ) in place of H (ˆ )
4/3/2024 © 2003, JH McClellan & RW Schafer 9
EXAMPLE 6.1
{bk }  { 1, 2, 1 }

H (e jˆ )  1  2e  jˆ  e  j 2ˆ EXPLOIT


 jˆ jˆ  jˆ SYMMETRY
e (e2e )
 e  jˆ (2  2 cosˆ )

Since ( 2  2 cos ˆ )  0
jˆ
Magnitude is H ( e )  ( 2  2 cos ˆ )
and Phase is  H ( e jˆ )  ˆ
4/3/2024 © 2003, JH McClellan & RW Schafer 10
PLOT of FREQ RESPONSE
{bk }  {1,2,1}

̂
H ( e jˆ )  ( 2  2 cos ˆ )e  jˆ RESPONSE at /3


4/3/2024 
̂ (radians)
© 2003, JH McClellan & RW Schafer 11
EXAMPLE 6.2
jˆ
Find y[n] when H (e ) is known
j / 4 j ( / 3) n
and x[n]  2e e
x[n] j̂ y[n]
H (e )

jˆ  jˆ
H ( e )  ( 2  2 cos ˆ )e
4/3/2024 © 2003, JH McClellan & RW Schafer 12
EXAMPLE 6.2 (answer)
j / 4 j ( / 3) n
Find y[n ] when x[n ]  2e e
jˆ
One Step - evaluate H ( e ) at ˆ   / 3
jˆ  jˆ
H ( e )  ( 2  2 cos ˆ )e
jˆ  j / 3
H (e )  3e @ ˆ   / 3
y[n ]  3e   j / 3
 2e j / 4 j ( / 3) n
e  6 e  j /12e j ( / 3) n

4/3/2024 © 2003, JH McClellan & RW Schafer 13


EXAMPLE: COSINE INPUT
jˆ
Find y[n] when H (e ) is known
 
and x[n]  2 cos(3 n  4 )
x[n] j̂ y[n]
H (e )
̂ ̂
jˆ  jˆ
H ( e )  ( 2  2 cos ˆ )e
4/3/2024 © 2003, JH McClellan & RW Schafer 14
EX: COSINE INPUT

Find y[n] when x[n]  2 cos( 


n )
3 4
j ( n / 3 / 4 )  j ( n / 3 / 4 )
2 cos(
3
n  4
 e) e
 x[n]  x1[n]  x2 [n]
j / 3 j ( n / 3 / 4 )
Use
Linearity
y1[n ]  H (e )e
 j / 3  j ( n / 3 / 4 )
y2 [ n ]  H ( e )e
4/3/2024
 y[n ]  y1[n ]  y2 [n ]
© 2003, JH McClellan & RW Schafer 15
EX: COSINE INPUT (ans-2)

Find y[n] when x[n]  2 cos( 


n )
3 4
jˆ  jˆ
H ( e )  ( 2  2 cos ˆ )e
j / 3 j ( n / 3 / 4 )  j ( / 3) j ( n / 3 / 4 )
y1[n]  H (e )e  3e e
 j / 3  j ( n / 3 / 4 ) j ( / 3)  j ( n / 3 / 4 )
y2 [ n ]  H ( e )e  3e e
j ( n / 3 / 12)  j ( n / 3 / 12)
y[n]  3e  3e
 
 y[n]  6 cos(3 n  12 )
4/3/2024 © 2003, JH McClellan & RW Schafer 16
EX:3 ex- pop quiz
Use the Inverse Euler formula to find
jŵ - jŵ /2
the impulse response h(n) for H(e ) = (2 j sin ŵ / 2)e

4/3/2024 © 2003, JH McClellan & RW Schafer 17


EX:3 pop quiz- answer
Use the Inverse Euler formula to find
jŵ - jŵ /2
the impulse response h(n) for H(e ) = (2 j sin ŵ / 2)e

jŵ jŵ /2 - jŵ /2 - jŵ /2


H (e ) = 2 j((e -e ) / 2 j)e
jŵ jŵ /2 - jŵ /2 - jŵ /2
H (e ) = (e -e )e
H (e jŵ ) = 1 - e - jŵ
bk = (1, - 1)
h(n) = d (n) - d (n - 1)
4/3/2024 © 2003, JH McClellan & RW Schafer 18
MATLAB:
FREQUENCY RESPONSE

 HH = freqz(bb,1,ww)
 VECTOR bb contains Filter Coefficients
 SP-First: HH = freekz(bb,1,ww)

 FILTER COEFFICIENTS {bk}


M
H (e )   bk e
jˆ  jˆ k

k 0
4/3/2024 © 2003, JH McClellan & RW Schafer 19
Time & Frequency Relation

 Get Frequency Response from h[n]


 Here is the FIR case:

M M
H (e )   bk e
jˆ  jˆ k
  h[k ] e  jˆ k

k 0 k 0

IMPULSE RESPONSE

4/3/2024 © 2003, JH McClellan & RW Schafer 20


BLOCK DIAGRAMS

 Equivalent Representations
x[n] y[n]
h[n]

x[n] j̂ y[n]


H (e )
wˆ ̂
4/3/2024 © 2003, JH McClellan & RW Schafer 21
UNIT-DELAY SYSTEM
jˆ
Find h[n ] and H ( e ) for y[n ]  x[n  1]
x[n]
 [n  1] y[n]

{bk }  { 0, 1 }
j̂
H (e )
x[n]  j̂ y[n]
e
wˆ wˆ
4/3/2024 © 2003, JH McClellan & RW Schafer 22
FIRST DIFFERENCE SYSTEM
jˆ
Find h[n] and H (e ) for theDifference
Equation : y[n]  x[n]  x[n  1]
x[n] y[n]
 [n]   [n  1]
j̂
H (e )
x[n]  j̂ y[n]
1 e
4/3/2024 © 2003, JH McClellan & RW Schafer 23
DLTI Demo with Sinusoids

x[n] FILTER y[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 24


CASCADE SYSTEMS
 Does the order of S1 & S2 matter?
 NO, LTI SYSTEMS can be rearranged !!!
 WHAT ARE THE FILTER COEFFS? {bk}
 WHAT is the overall FREQUENCY
RESPONSE ?

 [n] h1[n] h2 [n ]
S1 h1[n] S2 h1[n ]  h2 [n]

4/3/2024 © 2003, JH McClellan & RW Schafer 25


CASCADE EQUIVALENT
 MULTIPLY the Frequency Responses

x[n] jˆ jˆ y[n]


H1 ( e ) H 2 (e )
x[n] j̂ y[n]
H (e )
EQUIVALENT
jˆ jˆ jˆ
SYSTEM H ( e )  H1 ( e ) H 2 ( e )
4/3/2024 © 2003, JH McClellan & RW Schafer 26
Selected Problems/Demos-
Design A Simple Echo Canceller Filter, given H1
find H2?

x[n] jˆ j̂ y[n]


H1 ( e ) H eq (e )
Find H1 for echo signal.
A received microphone signal contains two
signals: one from the nearby speech itself, the
other from the far–end echoed speech signal.
say more than 20 meters…

4/3/2024 © 2003, JH McClellan & RW Schafer 27


Selected Problems/Demos-
Design Echo Canceller Filter, given H1 find Heq?

x[n] jˆ j̂ y[n]


H1 ( e ) H eq (e )

4/3/2024 © 2003, JH McClellan & RW Schafer 28


Selected Problems/Demos-
Design A Simple Echo Canceller Filter, given H1
find H2?

4/3/2024 © 2003, JH McClellan & RW Schafer 29


Ex- cascaded system

4/3/2024 © 2003, JH McClellan & RW Schafer 30


Ex- cascaded system

4/3/2024 © 2003, JH McClellan & RW Schafer 31


Selected Problems/Demos

 Visit moodle for additional excellent


materials:
 MATLAB demo echo canceller by Veyis
 PS Chapter 6, 2021 by Tuluhan
 And attend the Matlab session given by
Emre

4/3/2024 © 2003, JH McClellan & RW Schafer 33


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 34


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 35


Selected Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 36


Signal Processing First

Lecture 16- Chapter 8


Infinite Impulse Response (IIR)
Digital Filters: systems with
feedback

4/3/2024 © 2003, JH McClellan & RW Schafer 1


LECTURE OBJECTIVES
 INFINITE IMPULSE RESPONSE IIR FILTERS
 Define IIR Digital Filters
 Have FEEDBACK: use PREVIOUS OUTPUTS

 Show how to compute the output y[n]


 First-Order Case (N=1)
 Z-transform: Impulse Response h[n]  H(z)
4/3/2024 © 2003, JH McClellan & RW Schafer 2
Two examples of IIR filters
y(n) = (1/4) y(n-1)+1.x(n)

y[n] = a1y[n -1]+ b0x[n]

By the end of this lecture we will learn to show that


the difference equation (recurrence relation) for the
system below is

4/3/2024 © 2003, JH McClellan & RW Schafer 3


THREE DOMAINS: the big picture
Z-TRANSFORM-DOMAIN
POLYNOMIALS: H(z)
Use H(z) to get
Freq. Response
jwˆ
z=e
{a , bk } FREQ-DOMAIN
TIME-DOMAIN
M
N M
y[n ]   a y[n  ]   bk x[n  k ]  bk e  jˆ k

 1 k 0 H ( e jˆ )  k 0
N
1   ae  jˆ 
4/3/2024 5
© 2003, JH McClellan & RW Schafer
 1
Recall: Delay by nd

y[n ]  x[n  nd ]

IMPULSE RESPONSE h[n ]   [n  nd ]


 nd
SYSTEM FUNCTION
H ( z)  z
FREQUENCY RESPONSE jˆ  jˆ nd
H (e )  e
4/3/2024 © 2003, JH McClellan & RW Schafer 6
Infinite Impulse Response (IIR):
ONE FEEDBACK TERM

 ADD PREVIOUS OUTPUTS


y[n] = a1y[n - 1]+ b0x[n] + b1x[n - 1]
FIR PART of the FILTER
PREVIOUS FEED-FORWARD
FEEDBACK

 CAUSALITY
 NOT USING FUTURE OUTPUTS or INPUTS

4/3/2024 © 2003, JH McClellan & RW Schafer 8


IIR-Block-Diagram

4/3/2024 © 2003, JH McClellan & RW Schafer 9


FILTER COEFFICIENTS

 ADD PREVIOUS OUTPUTS


y[n] = 0.8y[n -1] + 3x[n] - 2x[n - 1]
FEEDBACK COEFFICIENT SIGN CHANGE

 MATLAB
 yy = filter([3,-2],[1,-0.8],xx)

4/3/2024 © 2003, JH McClellan & RW Schafer 10


COMPUTE OUTPUT

4/3/2024 © 2003, JH McClellan & RW Schafer 11


COMPUTE y[n]

 FEEDBACK DIFFERENCE EQUATION:


y[n] = 0.8y[n -1] + 5x[n]

 NEED y[-1] to get started

y[0] = 0.8y[ -1] + 5x[0]

4/3/2024 © 2003, JH McClellan & RW Schafer 12


AT REST CONDITION

 y[n] = 0, for n<0


 BECAUSE x[n] = 0, for n<0

4/3/2024 © 2003, JH McClellan & RW Schafer 13


COMPUTE y[0]

 THIS STARTS THE RECURSION:

 SAME with MORE FEEDBACK TERMS


2
y[n] = a1 y[n - 1] + a2 y[n - 2] + å b x[n - k]
k =0
k

4/3/2024 © 2003, JH McClellan & RW Schafer 14


COMPUTE MORE y[n]

 CONTINUE THE RECURSION:

4/3/2024 © 2003, JH McClellan & RW Schafer 15


PLOT y[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 16


IMPULSE RESPONSE
h[n] y[n -1]+ b0dx[n]
y[n] = a1h[n [n]

h[n]  b0 (a1 ) u[n]


n

u[n] = 1, for n ⇡ 0
4/3/2024 © 2003, JH McClellan & RW Schafer 17
IMPULSE RESPONSE
 DIFFERENCE EQUATION:
y[n] = 0.8y[n -1]+ 3x[n]
 Find h[n]
n
h[n] = 3(0.8) u[n]
 CONVOLUTION in TIME-DOMAIN

x[n] y[n] = h[n]* x[n]


h[n]
IMPULSE
RESPONSE
4/3/2024
LTI SYSTEM
© 2003, JH McClellan & RW Schafer 18
PLOT IMPULSE RESPONSE
n n
h[n] = b0 (a1) u[n] = 3(0.8) u[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 19


Infinite-Length Signal: h[n]
 POLYNOMIAL Representation
¥
H(z) = å
n= - ¥
h[n]z -n
APPLIES to
Any SIGNAL

 SIMPLIFY the SUMMATION


 
H ( z)   b (a ) u[n] z
n  
0 1
n n
 b0  a z
n 0
n n
1

4/3/2024 © 2003, JH McClellan & RW Schafer 20


Derivation of H(z)
 Recall Sum of Geometric Sequence:
¥
1
 Yields a COMPACT FORM
å
n=0
n
r =
1- r
 
H ( z )  b0  a z n n
1  b0  (a1 z ) 1 n

n 0 n 0

b0
 1
if z  a1
1  a1 z
4/3/2024 © 2003, JH McClellan & RW Schafer 21
H(z) = z-Transform{ h[n] }

 FIRST-ORDER IIR FILTER:


y[n] = a1y[n -1]+ b0x[n]
h[n]  b0 (a1 ) u[n]
n

b0
H(z) = -1
1 - a1 z
4/3/2024 © 2003, JH McClellan & RW Schafer 22
H(z) = z-Transform{ h[n] }

 ANOTHER FIRST-ORDER IIR FILTER:


y[n] = a1y[n - 1]+ b0x[n] + b1x[n - 1]
n n 1
h[n ]  b0 ( a1 ) u[n ]  b1 ( a1 ) u[n  1]
z 1 is a shift
-1 -1
b0 b1 z b0 + b1z
H(z) = -1 + -1 = -1
1 - a1 z 1 - a1 z 1 - a1 z
4/3/2024 © 2003, JH McClellan & RW Schafer 23
CONVOLUTION PROPERTY

 MULTIPLICATION of z-TRANSFORMS
X(z) Y(z) = H(z)X(z)
H(z)
 CONVOLUTION in TIME-DOMAIN

x[n] y[n] = h[n]* x[n]


h[n]
IMPULSE
RESPONSE
4/3/2024 © 2003, JH McClellan & RW Schafer 24
STEP RESPONSE: x[n]=u[n]

u[n] = 1, for n ⇡ 0

4/3/2024 © 2003, JH McClellan & RW Schafer 25


DERIVE STEP RESPONSE

4/3/2024 © 2003, JH McClellan & RW Schafer 26


PLOT STEP RESPONSE

y[n] = 0.8y[n -1]+ 3u[n] y[n] = 15(1 - 0.8


n+1
)u[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 27


H(z) = z-Transform{ h[n] }

 FIRST-ORDER CASE:
b0 = 1, a1 = a
n
h[n] = a u[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 28


Inverse z-Transform { h[n] }

4/3/2024 © 2003, JH McClellan & RW Schafer 29


Transposition theorem:
If we reverse the direction of all branches and replace x(n) with y(n),
Then the H(z) remains same. Illustration .
The firstone and the last one will have the same H(z). Prove that at home

Original

Reverse direction of all branches and


replaced x(n) with y(n),

Mirrored to view better (practically


nothing is done, convenient to Show the
input on the left)
4/3/2024 © 2003, JH McClellan & RW Schafer 30
Transposition theorem-
example 2
If we reverse the direction of all branches and replace x(n) with y(n),
Then the H(z) remains same. Illustration .
The firstone and the last one will have the same H(z). Prove that at home

Original

Reverse direction of all branches


and replaced x(n) with y(n),

Mirrored to view better


(practically nothing is done,
convenient to Show the input on
the left)

4/3/2024 © 2003, JH McClellan & RW Schafer 31


General form of IIR filters

v(n) is dummy point

Zeros- Feedforward Poles- Feedback


Referer to the Practical Guide at page2: Floating point implementation
When implementing a filter in floating point (i.e. using double or single precision arithmetic) Direct Form II structures are considered to be a better choice than the Direct Form
I structure. The Direct Form II Transposed structure is considered the most numerically accurate for floating point implementation, as the undesirable effects of numerical
swamping are minimised as seen by analysing the difference equations.
4/3/2024 © 2003, JH McClellan & RW Schafer 32
General form of IIR filters-
interchange the order of poles and
zeros in H(z)

v(n) is dummy point

Poles- Feedback Zeros- Feedforward


Zeros- Feedforward Poles- Feedback
Referer to the Practical Guide at page2: Floating point implementation
When implementing a filter in floating point (i.e. using double or single precision arithmetic) Direct Form II structures are considered to be a better
choice than the Direct Form I structure. The Direct Form II Transposed structure is considered the most numerically accurate for floating point
implementation, as the undesirable effects of numerical swamping are minimised as seen by analysing the difference equations.
4/3/2024 © 2003, JH McClellan & RW Schafer 33
General form of IIR filters- interchange the order of
poles and zeros in H(z)-combine delay operations
to minimize the use of delay operators(registry)

v(n) is dummy point

Poles- Feedback Zeros- Feedforward


Zeros- Feedforward Poles- Feedback
Referer to the Practical Guide at page2: Floating point implementation
When implementing a filter in floating point (i.e. using double or single precision arithmetic) Direct Form II structures are considered to be a better
choice than the Direct Form I structure. The Direct Form II Transposed structure is considered the most numerically accurate for floating point
implementation, as the undesirable effects of numerical swamping are minimised as seen by analysing the difference equations.
4/3/2024 © 2003, JH McClellan & RW Schafer 34
General form of IIR filters

v(n) is dummy point


Canonical

x(n) y(n)
M

Zeros- Feedforward Poles- Feedback


Referer to the Practical Guide at page2: Floating point implementation
When implementing a filter in floating point (i.e. using double or single precision arithmetic) Direct Form II structures are considered to be a better
choice than the Direct Form I structure. The Direct Form II Transposed structure is considered the most numerically accurate for floating point
implementation, as the undesirable effects of numerical swamping are minimised as seen by analysing the difference equations.
4/3/2024 © 2003, JH McClellan & RW Schafer 35
Signal Processing First- another IIR
example in cascade form
An IIR system: see the link below as a reference

4/3/2024 © 2003, JH McClellan & RW Schafer 36


Signal Processing First
IIR filters are mainly preferred for memory limited
applications including audio equalizers, biomedical and FIR
IoT sensors, telecommunications, etc.. Figure1. shows the
case where (low implementation cost) IIR requires less IIR
number of coefficients and memory than FIR filters in
order to satisfy a similar set of specifications, i.e., cut-off
frequency and stopband attenuation (Figure 1). However,
the stability in IIR design may become a problem!

FIR filters are prefererred for applications where linear


phase is important, but memory and computational
performance are not critical. e.g. audio and biomedical
signal enhancement applications. FIR is easier to
customize as compared to IIR, but FIR may be
problematic for real-time closed-loop control applications.

Ref: (A sample designer’ perspective)


[Link]
filters-a-practical-design-guide/

4/3/2024 © 2003, JH McClellan & RW Schafer 37


Signal Processing First-
an IIR application
X(k)

Understanding the behavior of an Unknown System using IIR:


e(k)= error
Adaptive algorithm: an optimization algorithm that will stop after a number
of iterations enables e(k) < predetermined threshold

4/3/2024 © 2003, JH McClellan & RW Schafer 38


Signal Processing First

Lecture 17
IIR Filters: H(z) and
Frequency Response

4/3/2024 © 2003, JH McClellan & RW Schafer 39


THREE DOMAINS
Z-TRANSFORM-DOMAIN
POLYNOMIALS: H(z)
Use H(z) to get
Freq. Response
jwˆ
z=e
{a , bk }
TIME-DOMAIN FREQ-DOMAIN
N M M
y[n ]   a y[n  ]   bk x[n  k ]  bk e  jˆ k

 1 k 0 H ( e jˆ )  k 0
N
1   ae  jˆ 
4/3/2024 © 2003, JH McClellan & RW Schafer 40
 1
H(z) = z-Transform{ h[n] }

 FIRST-ORDER IIR FILTER:


y[n] = a1y[n -1]+ b0x[n]
h[n]  b0 (a1 ) u[n]
n

b0
H(z) = -1
1 - a1 z
4/3/2024 © 2003, JH McClellan & RW Schafer 41
Typical IMPULSE Response

n n
h[n] = b0 (a1) u[n] = 3(0.8) u[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 42


First-Order Transform Pair

n b
h[n] = ba u[n]  H(z) = -1
1- az
 GEOMETRIC SEQUENCE:
 
H ( z )  b0  a1n z n  b0  (a1 z 1 ) n
n 0 n 0

b0
 if z  a1
1  a1 z 1
4/3/2024 © 2003, JH McClellan & RW Schafer 43
DELAY PROPERTY of X(z)
 DELAY in TIME<-->Multiply X(z) by z-1
x[n] X(z)
x[n - 1]  z X(z) -1

4/3/2024 © 2003, JH McClellan & RW Schafer 44


Z-Transform of IIR Filter
 DERIVE the SYSTEM FUNCTION H(z)
 Use DELAY PROPERTY

y[n] = a1y[n - 1]+ b0x[n] + b1x[n - 1]


-1 -1
Y(z) = a1z Y(z) + b0X(z) + b1 z X(z)
EASIER with DELAY PROPERTY

4/3/2024 © 2003, JH McClellan & RW Schafer 45


SYSTEM FUNCTION of IIR

 NOTE the FILTER COEFFICIENTS


-1 -1
Y(z) - a1z Y(z) = b0 X(z) + b1 z X(z)
-1 -1
(1 - a1z )Y(z) = (b0 + b1z )X(z)
-1
Y(z) b0 + b1 z B(z)
H(z) = = -1 =
X(z) 1 - a1 z A(z)
4/3/2024 © 2003, JH McClellan & RW Schafer 46
SYSTEM FUNCTION
 DIFFERENCE EQUATION:

y[n] = 0.8y[n -1] + 3x[n] - 2x[n - 1]


 READ the FILTER COEFFS: H(z)

1
 3  2z 
Y ( z )   
1 
X ( z )
 1  0.8 z 
4/3/2024 © 2003, JH McClellan & RW Schafer 47
CONVOLUTION PROPERTY

 MULTIPLICATION of z-TRANSFORMS
X(z) Y(z) = H(z)X(z)
H(z)
 CONVOLUTION in TIME-DOMAIN

x[n] y[n] = h[n]* x[n]


h[n]
IMPULSE
RESPONSE
4/3/2024 © 2003, JH McClellan & RW Schafer 48
POLES & ZEROS
 ROOTS of Numerator & Denominator
-1
b0 + b1 z b0 z + b1
H(z) = - 1  H(z) =
1 - a1 z z - a1
b1
b0 z + b1 = 0 ↵ z=- ZERO:
b0 H(z)=0

z - a1 = 0 ↵ z = a1 POLE: H(z)  inf

4/3/2024 © 2003, JH McClellan & RW Schafer 49


EXAMPLE: Poles & Zeros

 VALUE of H(z) at POLES is INFINITE


1
2  2z
H ( z)  1
1  0 .8 z
2  2( 1)
H ( z)  0 ZERO at z= -1
1  0.8( 1)

2  2( 45 ) 1 9
POLE at z=0.8
H ( z)  1
 2
 
1  0.8( 45 ) 0
4/3/2024 © 2003, JH McClellan & RW Schafer 50
POLE-ZERO PLOT

ZERO at z = -1

POLE at
-1
2 + 2z z = 0.8
-1
1 - 0.8z
4/3/2024 © 2003, JH McClellan & RW Schafer 51
FREQUENCY RESPONSE
 SYSTEM FUNCTION: H(z)
 H(z) has DENOMINATOR
 FREQUENCY RESPONSE of IIR
 We have H(z)
jwˆ
H(e ) = H(z ) z = e jwˆ
 THREE-DOMAIN APPROACH
jwˆ
h[n]  H(z)  H(e )
4/3/2024 © 2003, JH McClellan & RW Schafer 52
FREQUENCY RESPONSE
 EVALUATE on the UNIT CIRCLE
jwˆ
H(e ) = H(z ) z = e jwˆ

4/3/2024 © 2003, JH McClellan & RW Schafer 53


FREQ. RESPONSE FORMULA
1  jˆ
2  2z jˆ 2  2e
H ( z)  1
 H (e )   jˆ
1  0.8 z 1  0.8e
 jˆ 2  jˆ jˆ
jˆ 2 2  2e 2  2e 2  2e
H (e )   jˆ
  jˆ
 jˆ
1  0.8e 1  0.8e 1  0.8e
 jˆ jˆ
4  4  4e  4e 8  8 cos ˆ

1  0.64  0.8e  jˆ
 0.8e jˆ 1.64  1.6 cos ˆ
88
jˆ 2
@ ˆ  0, H (e )   400, @ ˆ   ?
4/3/2024 0.04
© 2003, JH McClellan & RW Schafer 54
Frequency Response Plot
 jˆ
2  2 e
H ( e jˆ ) 
1  0.8e  jˆ

4/3/2024 © 2003, JH McClellan & RW Schafer 55


UNIT CIRCLE
 MAPPING BETWEEN z and wˆ
jwˆ
z=e
z=1  wˆ = 0
z = -1  wˆ = ± p
ˆ
z = ±j  w = ± 2p
1

4/3/2024 © 2003, JH McClellan & RW Schafer 56


3-D VIEWPOINT:
3-D VIEW
EVALUATE H(z) EVERYWHERE

WHERE is
the POLE ?

UNIT CIRCLE
4/3/2024 © 2003, JH McClellan & RW Schafer 57
MOVIE for H(z) in 3-D
 POLES to H(z) to Frequency Reponse
 TWO POLES SHOWN

4/3/2024 © 2003, JH McClellan & RW Schafer 58


Frequency Response from H(z)

Walking around the Unit Circle

4/3/2024 © 2003, JH McClellan & RW Schafer 59


3 DOMAINS MOVIE-1: IIR
y[n] = a1y[n -1]+ b0x[n] 1st order IIR >> a block diagram

b
h[n] = ba n u[n]  H(z) =
1 - a z-1 h(n) and H(z) for 1st order IIR

Lets H(z)
observe
what
happens
when pole
moves H ( e j̂ )
towards left

h[n]

4/3/2024 © 2003, JH McClellan & RW Schafer


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 61


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 62


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 63


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 64


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 65


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 66


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 67


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 68


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 69


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 70


3 DOMAINS MOVIE-1: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 71


3 DOMAINS MOVIE: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 72


3 DOMAINS MOVIE: IIR

4/3/2024
5/24/21 ©©2003,
2003,JH
JHMcClellan
McClellan&&RW
RWSchafer
Schafer 73
51
3 DOMAINS MOVIE: IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 74


3 DOMAINS MOVIE: IIR

4/3/2024
5/24/21 © 2003, JH McClellan & RW Schafer 75
53
3 DOMAINS MOVIE: IIR

4/3/2024
5/24/21 © 2003, JH McClellan & RW Schafer 76
54
3 DOMAINS MOVIE: IIR

4/3/2024
5/24/21 © 2003, JH McClellan & RW Schafer 77
55
PeZ Demo: Pole-Zero Placing

4/3/2024 © 2003, JH McClellan & RW Schafer 78


SINUSOIDAL RESPONSE

 x[n] = SINUSOID => y[n] is SINUSOID


 Get MAGNITUDE & PHASE from H(z)
jˆ n
if x[n ]  e
jˆ jˆ n
then y[n ]  H ( e ) e
jˆ
where H ( e )  H ( z ) z e jˆ
4/3/2024 © 2003, JH McClellan & RW Schafer 79
POP QUIZ

-1
 Given: 2 + 2z
H( z) = -1
1 - 0.8z
 Find the Impulse Response, h[n]
 Find the output, y[n]
 When
x[n] = cos(0.25p n)
4/3/2024 © 2003, JH McClellan & RW Schafer 80
Evaluate FREQ. RESPONSE
z  1 is ˆ  0 2 + 2z - 1 ˆ
-1 at w = 0.25 p
1 - 0.8z

wˆ = 0.25p zero at 

4/3/2024 © 2003, JH McClellan & RW Schafer 81


POP QUIZ: Eval Freq. Resp.
-1
 Given: 2 + 2z
H( z) = -1
1 - 0.8z
 Find output, y[n], x[n] = cos(0.25p n)
when j0.25p
 Evaluate at
z= e

2  2( 22  j 22 )  j1.309
H ( z)   j 0.25
 5.182e
1  0.8e
y[n] = 5.182cos(0.25p n - 0.417p )
4/3/2024 © 2003, JH McClellan & RW Schafer 82
CASCADE EQUIVALENT

 Multiply the System Functions


x[n] y[n]
H1 (z) H2 (z)
x[n] y[n]
H(z)
EQUIVALENT
SYSTEM H(z) = H1(z)H2 (z)
4/3/2024 © 2003, JH McClellan & RW Schafer 83
Signal Processing First
Lecture 18
3-Domains for IIR

4/3/2024 © 2003, JH McClellan & RW Schafer 1


READING ASSIGNMENTS

 This Lecture:
 Chapter 8, all

 Other Reading:
 Recitation: Ch. 8, all
 POLES & ZEROS
 Next Lecture: Chapter 9

4/3/2024 © 2003, JH McClellan & RW Schafer 3


LECTURE OBJECTIVES
 SECOND-ORDER IIR FILTERS
 TWO FEEDBACK TERMS
2
y[n] = a1 y[n - 1] + a2 y[n - 2] + å b x[n - k]
k =0
k

 H(z) can have COMPLEX POLES & ZEROS


 THREE-DOMAIN APPROACH
 BPFs have POLES NEAR THE UNIT CIRCLE

4/3/2024 © 2003, JH McClellan & RW Schafer 4


THREE DOMAINS
Use H(z) to get Z-TRANSFORM-DOMAIN: poles & zeros
Freq. Response POLYNOMIALS: H(z)
å bz
-k
jwˆ
z=e
k
H( z) =
1- å a z
-

TIME-DOMAIN FREQ-DOMAIN
M
 bk e
N M  jˆ k
y[n]   a y[n  ]   bk x[n  k ]
1 k 0 H (e jˆ )  k 0
N
1   ae  jˆ 
4/3/2024 © 2003, JH McClellan & RW Schafer 5
1
Z-TRANSFORM TABLES

4/3/2024 © 2003, JH McClellan & RW Schafer 6


SECOND-ORDER FILTERS
 Two FEEDBACK TERMS

y[n] = a1 y[n - 1] + a2 y[n - 2]


+ b0 x[n] + b1 x[n - 1] + b2 x[n - 2]
-1 -2
b0 + b1z + b2 z
H(z) = -1 -2
1 - a1z - a2 z
4/3/2024 © 2003, JH McClellan & RW Schafer 7
MORE POLES
 Denominator is QUADRATIC
 2 Poles: REAL
 or COMPLEX CONJUGATES
-1 -2 2
b0 + b1 z + b2 z b0 z + b1 z + b2
H(z) = -1 -2 = 2
1 - a1 z - a2 z z - a1 z - a2

4/3/2024 © 2003, JH McClellan & RW Schafer 8


TWO COMPLEX POLES
 Find Impulse Response ?
 Can OSCILLATE vs. n

= (re )
 “RESONANCE” jq n
( pk )
n n jnq
=re
 Find FREQUENCY RESPONSE
 Depends on Pole Location jq
 Close to the Unit Circle?
pole = re
 Make BANDPASS FILTER r 1?
4/3/2024 © 2003, JH McClellan & RW Schafer 9
2nd ORDER EXAMPLE

h[n]  (0.9)n cos(3 n)u[n]  (0.9)n 12 (e j n / 3  e j n / 3 )u[n]


0.5 0.5
H(z) = j p /3 - 1 + - jp / 3 -1
1 - 0.9e z 1 - 0.9e z
-1
1 - 0.9cos( 3 )z p
H(z) = j p /3 - 1 - j p /3 - 1
(1 - 0.9e z )(1 - 0.9e z )
-1
1 - 0.45z
H(z) = -1 -2
4/3/2024 1 - 0.9z + 0.81z© 2003, JH McClellan & RW Schafer 10
h[n]: Decays & Oscillates
“PERIOD”=6

n p
h[n] = (0.9) cos( 3 n)u[n]
-1
1 - 0.45z
-1 -2
4/3/2024
1 - 0.9z + 0.81z
© 2003, JH McClellan & RW Schafer 11
2nd ORDER Z-transform PAIR
GENERAL ENTRY for
n z-Transform TABLE
h[n] = r cos(qn)u[n]
1 - r cosq z -1
H(z) = -1 2 -2
1 - 2r cosq z + r z
n
h[n] = Ar cos(qn + j )u[n]
cos j - r cos(q - j )z -1
H(z) = A -1 2 -2
1 - 2r cos q z + r z
4/3/2024 © 2003, JH McClellan & RW Schafer 12
2nd ORDER EX: n-Domain
-1
1 - 0.45z
-1 -2
1 - 0.9z + 0.81z
y[n] = 0.9y[n - 1] - 0.81y[n - 2]+ x[n] - 0.45x[n - 1]
aa = [ 1, -0.9, 0.81 ];
bb = [ 1, -0.45 ];
nn = -2:19;
hh = filter( bb, aa, (nn==0) );
HH = freqz( bb, aa, [-pi,pi/100:pi] );
4/3/2024 © 2003, JH McClellan & RW Schafer 13
Complex POLE-ZERO PLOT

-2
1- z
-2
1 + 0.7225z

4/3/2024 © 2003, JH McClellan & RW Schafer 14


UNIT CIRCLE
 MAPPING BETWEEN z and wˆ
jwˆ
z=e
z=1  wˆ = 0
z = -1  wˆ = ± p
ˆ
z = ±j  w = ± 2p
1

4/3/2024 © 2003, JH McClellan & RW Schafer 15


FREQUENCY RESPONSE
from POLE-ZERO PLOT
- j 2 wˆ
1- e
jwˆ
H(e ) = - j 2wˆ
1+ 0.7225e

4/3/2024 © 2003, JH McClellan & RW Schafer 16


h[n]: Decays & Oscillates
“PERIOD”=6

n p
h[n] = (0.9) cos( 3 n)u[n]
-1
1 - 0.45z
-1 -2
4/3/2024
1 - 0.9z + 0.81z
© 2003, JH McClellan & RW Schafer 17
Complex POLE-ZERO PLOT

-1
1 - 0.45z
-1 -2
1 - 0.9z + 0.81z
4/3/2024 © 2003, JH McClellan & RW Schafer 18
h[n]: Decays & Oscillates
“PERIOD”=12

n p
h[n] = (0.95) cos( 6 n)u[n]
-1
1 - 0.8227 z
-1 -2
4/3/2024
1 - 1.6454 z + 0.9025z
© 2003, JH McClellan & RW Schafer 19
Complex POLE-ZERO PLOT

-1
1 - 0.8227 z
-1 -2
1 - 1.6454 z + 0.9025z
4/3/2024 © 2003, JH McClellan & RW Schafer 20
3 DOMAINS MOVIE: IIR
POLE MOVES

H(z)

H()
h[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 21


THREE INPUTS
 Given: 5
H(z) = -1
1 + 0.8z
 Find the output, y[n]
 When
x[n] = cos(0.2p n)
x[n] = u[n]
x[n] = cos(0.2p n)u[n]
4/3/2024 © 2003, JH McClellan & RW Schafer 22
SINUSOID ANSWER
 Given: 5
H(z) = -1
1 + 0.8z
 The input: x[n] = cos(0.2 p n)
 Then y[n]
y[n] = M cos(0.2p n + y )
j 0.2 5 j 0.089
H (e )  j 0.2
 2.919e
1  0.8e
4/3/2024 © 2003, JH McClellan & RW Schafer 23
Step Response
æ 5 öæ 1 ö
Y(z) = H(z)X(z) =
è 1 + .8z - 1 ø è 1 - z - 1 ø
Partial Fraction Expansion
-1
A B (A + B) + (.8B - A)z
Y(z) = -1 + -1 =
1 + .8z 1- z -1
1 + .8z 1 - z -1
( )( )
↵ (A + B) = 5 and (.8B - A) = 0
A B
Y(z) = -1 + -1
1 + .8z 1- z
4/3/2024 © 2003, JH McClellan & RW Schafer 27
Step Response

20 25
Y(z) = 9 + 9
-1 -1
1 + .8z 1- z
20 n 25
y[n] = ( -.8) u[n] + u[n]
9 9
25
y[n]  as n  
9
4/3/2024 © 2003, JH McClellan & RW Schafer 28
Stability
¥
 Nec. & suff. condition: å h[n] < ¥
n= - ¥
n b
h[n] = b(a) u[n]  H(z) = -1
1 - az
¥
n Pole must be
å b a < ¥ if a < 1 ↵ Inside unit circle
n=0
4/3/2024 © 2003, JH McClellan & RW Schafer 29
SINUSOID starting at n=0
 We’ll look at an example in MATLAB
 cos(0.2n)
 Pole at –0.8, so an is (–0.8) n
 There are two components:
 TRANSIENT
 Start-up region just after n=0; (–0.8) n
 STEADY-STATE
 Eventually, y[n] looks sinusoidal.
 Magnitude & Phase from Frequency Response

4/3/2024 © 2003, JH McClellan & RW Schafer 30


Cosine input
cos(0.2pn)u[n]
n
( -0.8)

2p
wˆ 0 =
10

4/3/2024 © 2003, JH McClellan & RW Schafer 31


STABILITY

 When Does the TRANSIENT DIE OUT ?

need a1 < 1
4/3/2024 © 2003, JH McClellan & RW Schafer 32
STABILITY CONDITION
 ALL POLES INSIDE the UNIT CIRCLE
 UNSTABLE EXAMPLE: POLE @ z=1.1

x[n] = cos(0.2pn)u[n]

4/3/2024 © 2003, JH McClellan & RW Schafer 33


BONUS QUESTION
 Given: 5
H(z) = -1
1 + 0.8z
 The input is
x[n]  4 cos( n  0.5 )

 Then find y[n]


y[n]  ?

4/3/2024 © 2003, JH McClellan & RW Schafer 34


GENERAL INVERSE Z

(pole)n
4/3/2024 © 2003, JH McClellan & RW Schafer 37
SPLIT Y(z) to INVERT
 Need SUM of Terms:

4/3/2024 © 2003, JH McClellan & RW Schafer 38


INVERT Y(z) to y[n]

 Use the Z-Transform Table

4/3/2024 © 2003, JH McClellan & RW Schafer 39


TWO PARTS of y[n]
 TRANSIENT
 Acts Like (pole)n æ b0 a1 ö n
 Dies out ? ç jwˆ 0 ÷ a1 u[n]
 IF |a1|<1 è a1 - e ø
 STEADY-STATE
 Depends on the input
 e.g., Sinusoidal
æ b0 ö jwˆ 0 n
ç - jwˆ 0 ÷ e u[n]
4/3/2024
è 1 - a1 e ø
© 2003, JH McClellan & RW Schafer 40
STEADY STATE HAPPENS

 When Transient dies out


 Limit as “n” approaches infinity
 Use Frequency Response to get
Magnitude & Phase for sinusoid

 b0  jwˆ 0 n jwˆ 0 jwˆ 0 n


yss[n]  - jwˆ 0  e = H(e )e
1 - a1e 
4/3/2024 © 2003, JH McClellan & RW Schafer 41
NUMERICAL EXAMPLE

4/3/2024 © 2003, JH McClellan & RW Schafer


0.089p = 0.2781 42
REALISTIC FIR BANDPASS

 FIR
 L = 24
 M=23
 23 zeros

4/3/2024 © 2003, JH McClellan & RW Schafer 43


FIR BPF: 23 ZEROS

4/3/2024 © 2003, JH McClellan & RW Schafer 44


Complex POLE-ZERO PLOT

2z(z + 1)
2
z - z +1
4/3/2024 © 2003, JH McClellan & RW Schafer 45
POLES & ZEROS of IIR

3 POLES

4/3/2024 © 2003, JH McClellan & RW Schafer 46


IIR Elliptic LPF (N=3)

3 POLES

4/3/2024 © 2003, JH McClellan & RW Schafer 47


A Sample 3-D VIEW
Fig 8.24

EVALUATE H(z)
-2
EVERYWHERE 1- z
-2
1 + 0.7225z

UNIT CIRCLE
4/3/2024 © 2003, JH McClellan & RW Schafer 48
FLYING THRU Z-PLANE

H()

H(z)

POLES CAUSE
PEAKS in H(z)

4/3/2024 © 2003, JH McClellan & RW Schafer 49


Solved Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 50


Solved Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 51


Solved Problems/Demos

4/3/2024 © 2003, JH McClellan & RW Schafer 52


Solved Problems/Demos-Find h(n)
given difference equation

4/3/2024 © 2003, JH McClellan & RW Schafer 53


Solved Problems/Demos-Find h(n)
given difference equation

4/3/2024 © 2003, JH McClellan & RW Schafer 54


Solved Problems/Demos-
Multiple Poles-Solve at home

4/3/2024 © 2003, JH McClellan & RW Schafer 55


Signal Processing First

Lecture 22- 23
the Fourier Transform
(Read: Chapter 11 in your book)

4/3/2024 © 2003, JH McClellan & RW Schafer 1


WHY use the Fourier transform?

 Fourier transform: extension of the Fourier series to non-periodic functions


 i.e. what frequencies are present in your signal and in what proportions.

 Use Fourier Transform to manipulate the “Frequency Spectrum”


st
X ( s)  x (t ) e dt LaplaceTransform


s    j and   0


 jwt
X ( jw)  x (t ) e dt Fourier Transform


4/3/2024 © 2003, JH McClellan & RW Schafer 3


Fourier Transform Pairs

Fourier Analysis
 j t
X ( j )   x ( t ) e dt (Forward Transform)


1 j t Fourier Synthesis
x (t ) 
2  X ( j )e d (Inverse Transform)


Time - Domain  Frequency - Domain


4/3/2024
x (t )  X ( j )
© 2003, JH McClellan & RW Schafer 4
- at
Example 1: x(t) = e u(t)
¥ ¥
- jw t - (a+ jw )t
X( jw ) = ò e - at
e dt = ò e dt
0 0
- at - jw t ¥ a>0
e e 1
X( jw ) = - =
a + jw 0
a + jw
1
X( jw ) =
a + jw
4/3/2024 © 2003, JH McClellan & RW Schafer 5
Frequency Response
 Fourier Transform of h(t) is the Frequency
Response

h (t )  e  t u (t )

t 1
h(t )  e u(t )  H ( j ) 
1  j
4/3/2024 © 2003, JH McClellan & RW Schafer 6
Magnitude and Phase Plots
1 1 1
H ( j )  
a  j a  j a2   2

1  

H ( j )   tan  
a

H (  j )  H  ( j )
4/3/2024 © 2003, JH McClellan & RW Schafer 7
Ex.1.1 bilateral –two sided
exp. case

4/3/2024 © 2003, JH McClellan & RW Schafer 8


ì1 t <T /2
x(t) = í
Example 2: î0 t >T /2

T /2 T /2
- jw t - jw t
X( jw ) = ò (1)e dt = ò e dt
-T/2 -T/2

- jw t T /2 - jw T / 2 jw T /2
e e -e
X( jw ) = =
- jw - T/2
- jw

sin(wT / 2)
X( jw ) =
(w / 2)
4/3/2024 © 2003, JH McClellan & RW Schafer 9
1 t <T /2 sin(wT / 2)
x(t) =   X( jw ) =
0 t >T /2 (w / 2 )

4/3/2024 © 2003, JH McClellan & RW Schafer 10


1   b

X ( j )  
Example 3:
0   b

 b
1 j t 1 j t
x (t ) 
2  X ( j ) e d 
2  1 e d
  b

j t b jb t  jb t
1 e 1 e e
x (t )  
2 jt b
2 jt

sin( bt )
x (t ) 
4/3/2024
t
© 2003, JH McClellan & RW Schafer 11
sin(bt ) 1   b

x (t )   X ( j )  
t
0   b

4/3/2024 © 2003, JH McClellan & RW Schafer 12


Example 4:
x (t )   (t  t0 )

¥
- jw t
X( jw ) = ò d (t)e dt = 1

Shifting Property of the Impulse



X ( j )    (t  t0 )e  j t
dt  e  j t0


4/3/2024 © 2003, JH McClellan & RW Schafer 13
x(t) = d (t)  X( jw ) = 1

4/3/2024 © 2003, JH McClellan & RW Schafer 14


Example 5: X( jw ) = 2pd (w - w 0 )
¥
1 jwt jw 0 t
x(t) =
2p
ò 2pd (w - w 0 )e dw = e

jw 0 t
x(t) = e  X( jw ) = 2pd (w - w 0 )
x(t) = 1  X( jw ) = 2pd (w )
x(t) = cos(w 0 t) 
4/3/2024 X( jw ) = pd (w - w 0 ) + pd (w + w 0 )
© 2003, JH McClellan & RW Schafer 15
x(t) = cos(w 0 t) 
X( jw ) = pd (w - w 0 ) + pd (w + w 0 )

4/3/2024 © 2003, JH McClellan & RW Schafer 16


Table of Fourier Transforms
- at 1
x(t) = e u(t)  X( jw ) =
a + jw
1 t < T / 2 sin(wT / 2)
x(t) =   X( jw ) =
0 t > T / 2 (w / 2 )
sin(w 0 t) 1 w < w 0
x(t) =  X( jw ) = 
(p t ) 0 w > w 0
- jw t 0
x(t) = d (t - t0 )  X( jw ) = e
jw 0 t
x(t) = e
4/3/2024
 X( jw ) = 2pd (w - w 0 )
© 2003, JH McClellan & RW Schafer 17
Fourier Transform
Properties
Time-Domain  Frequency-Domain
x(t)  X( jw )
Dualityprinciple
X(t)  2 p x(- w )
DifferentiationinTimeDomain
dx(t) / dt  jw X( jw )
[Link]
- jtx(t)  dX( jw ) / dw
4/3/2024 © 2003, JH McClellan & RW Schafer 18
Signal Processing First

Lecture 23
Fourier Transform
Properties

4/3/2024 © 2003, JH McClellan & RW Schafer 19


LECTURE OBJECTIVES
 The Fourier transform

 j t
X ( j )   x ( t ) e dt

 More examples of Fourier transform pairs
 Basic properties of Fourier transforms
 Convolution property
 Multiplication property
4/3/2024 © 2003, JH McClellan & RW Schafer 20
Frequency Response
 Fourier Transform of h(t) is the Frequency
Response

h (t )  e  t u (t )

t 1
h(t )  e u(t )  H ( j ) 
1  j
4/3/2024 © 2003, JH McClellan & RW Schafer 21

1 t T /2 sin(T / 2)
x (t )    X ( j ) 
 t T /2  /2
0

4/3/2024 © 2003, JH McClellan & RW Schafer 22


sin(bt ) 
1    b
x (t )   X ( j )  
t
0   b

4/3/2024 © 2003, JH McClellan & RW Schafer 23


 j t0
x(t )   (t  t0 )  X ( j )  e

t0  0

4/3/2024 © 2003, JH McClellan & RW Schafer 24


Table of Fourier Transforms
t 1
x (t )  e u (t )  X ( j ) 
1  j

1 t T /2 sin(T / 2)
x (t )    X ( j ) 
 t T /2  /2
0

sin(bt ) 1   b

x (t )   X ( j )  
t
0   b

 j t0
x(t )   (t  t0 )  X ( j )  e
jct
x(t )  e
4/3/2024  X ( j )  2 (  c )
© 2003, JH McClellan & RW Schafer 25
x (t )  cos(ct )  X ( j )   (   c )   (  c )

4/3/2024 © 2003, JH McClellan & RW Schafer 26


Fourier Transform of a
General Periodic Signal
 If x(t) is periodic with period T0 ,
 T0
1
x (t )   ak e jk0 t
ak 
T0  x (t )e
 jk0 t
dt
k   0

jk0t
Therefore,since e  2 (  k0 )

X ( j )   2 ak (  k0 )
k 
4/3/2024 © 2003, JH McClellan & RW Schafer 27
Square Wave Signal
x(t) = x(t + T0 )

- 2T0 - T0 0 T0 2T0 t

T0 / 2 T0
1 - jw 0 kt 1 - jw 0 kt
ak =
T0 ò (1)e
0
dt + ò
T0 T0 / 2
( - 1)e dt

- jw 0 kt T0 / 2 - jw 0 kt T0
- j pk
e e 1- e
ak = - =
- jw 0 kT0 - j w 0 kT0 T
0 © 2003, JH McClellan & RW Schafer
j pk
4/3/2024 0 /2 28
Square Wave Fourier Transform

x(t) = x(t + T0 )

- 2T0 - T0 0 T0 2T0 t

¥
X( jw ) = å 2 p a d (w - k w
k=- ¥
k 0 )

4/3/2024 © 2003, JH McClellan & RW Schafer 29


Table of Easy FT Properties
Linearity Property
ax1(t) + bx2 (t)  aX1( jw ) + bX2 ( jw )
Delay Property
- jw t d
x(t - td )  e X( jw )
Frequency Shifting
jw 0 t
x(t)e  X( j(w - w 0 ))
Scaling
x(at)  1
|a| X( j( )) w
a
4/3/2024 © 2003, JH McClellan & RW Schafer 30
Scaling Property

x(at )  1 X( 
j )
a a
 
 j t  j (  / a ) d
 x ( at ) e dt  
x (  )e a
 

 1
a
X ( j a )

x(2t ) shrinks; 1 
X ( j ) expands
2 2
4/3/2024 © 2003, JH McClellan & RW Schafer 31
Scaling Property
x(at )  1
a
X ( j a )

x2 (t )  x1 (2t )

4/3/2024 © 2003, JH McClellan & RW Schafer 32


Uncertainty Principle
 Try to make x(t) shorter
 Then X(j) will get wider
 Narrow pulses have wide bandwidth
 Try to make X(j) narrower
 Then x(t) will have longer duration
 Cannot simultaneously reduce time
duration and bandwidth

4/3/2024 © 2003, JH McClellan & RW Schafer 33


Significant FT Properties
x(t) *h(t)  H( jw )X( jw )
1
x(t)p(t)  X( jw )* P( jw )
2p
jw 0 t
x(t)e  X( j(w - w 0 ))

Differentiation Property
dx(t)
 ( jw )X( jw )
4/3/2024 dt © 2003, JH McClellan & RW Schafer 34
Convolution Property

x(t) y(t) = h(t) * x(t)

X( jw ) Y( jw ) = H( jw )X( jw )
 Convolution in the time-domain
¥
y(t) = h(t) * x(t) = ò h( t )x(t - t )d t

corresponds to MULTIPLICATION in the
frequency-domain Y( jw ) = H( jw )X( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 35
Convolution Example
 Bandlimited Input Signal
 “sinc” function

 Ideal LPF (Lowpass Filter)


 h(t) is a “sinc”

 Output is Bandlimited
 Convolve “sincs”

4/3/2024 © 2003, JH McClellan & RW Schafer 36


Ideally Bandlimited Signal
sin(100 t ) 1   100

x (t )   X ( j )  
t
0   100

b  100 

4/3/2024 © 2003, JH McClellan & RW Schafer 37


Convolution Example
x(t) *h(t)  H( jw )X( jw )
sin(100p t) sin(200p t) sin(100p t)
* =
pt pt pt

4/3/2024 © 2003, JH McClellan & RW Schafer 38


Cosine Input to LTI System
Y (j w ) = H( jw )X(j w )
= H( jw )[pd (w - w 0 ) + pd (w + w 0 )]
= H( jw 0 ) pd (w - w 0 ) + H( - jw 0 ) pd (w + w 0 )
jw 0 t - jw 0t
y(t) = H (j w 0 ) e + H( - j w 0 ) e
1
2
1
2
1 jw0 t * 1 - jw0 t
= H( jw 0 ) 2 e + H ( jw 0 ) 2 e
= H( jw 0 ) cos(w 0t + H( jw 0 ))
4/3/2024 © 2003, JH McClellan & RW Schafer 39
Ideal Lowpass Filter

Hlp ( jw )

- w co w co
y(t) = x(t) if w 0 < w co
y(t) = 0 if w 0 > w co
4/3/2024 © 2003, JH McClellan & RW Schafer 40
Ideal Lowpass Filter
ì 1 w < w co
H( jw ) = í
î 0 w > w co

f co "cutoff freq."

4 4
y(t) = sin(50pt ) + sin (150pt )
p 3p

4/3/2024 © 2003, JH McClellan & RW Schafer 41


Signal Multiplier (Modulator)
x(t) y(t) = p(t)x(t)
X( jw ) Y( jw ) =
1
X( jw ) * P( jw )
2p
p(t)

 Multiplication in the time-domain


corresponds to convolution in the
frequency-domain.
1 ¥
Y( jw ) = ò X( jq )P( j(w - q ))dq
4/3/2024
2p - ¥
© 2003, JH McClellan & RW Schafer 42
Frequency Shifting Property
jw 0 t
x(t)e  X( j(w - w 0 ))
 
j0t  j t  j ( 0 ) t
e x (t )e dt   x (t )e dt
 
 X ( j (  0 ))
sin 7t jw 0 t 1 w 0 -7 < w < w 0 +7
y(t) = e  Y( jw ) = 
4/3/2024
pt 0 elsewhere
© 2003, JH McClellan & RW Schafer 43
y(t) = x(t)cos(w 0 t) 
1 1
Y( jw ) = X( j(w - w 0 )) + X( j(w + w 0 ))
2 2
x(t)

4/3/2024 © 2003, JH McClellan & RW Schafer 44


Differentiation Property
dx(t ) dæ 1 ¥ jw t ö
= ç ò X( jw )e dw ÷
dt dt è 2p - ¥ ø
Multiply by j
¥
1 jw t
=
2p
ò ( jw ) X( jw )e dw

d - at
dt
( )- at - at
e u(t) = - ae u(t) + e d (t)

jw
= d (t) - ae - at
u(t) a + jw
4/3/2024 © 2003, JH McClellan & RW Schafer 45
Signal Processing First

Lecture 24
Amplitude Modulation (AM)

4/3/2024 © 2003, JH McClellan & RW Schafer 1


LECTURE OBJECTIVES
 Review of FT properties
 Convolution <--> multiplication
 Frequency shifting

 Sinewave Amplitude Modulation


 AM radio
 Frequency-division multiplexing
 FDM
 Reading: Chapter 12, Section 12-2
4/3/2024 © 2003, JH McClellan & RW Schafer 3
Table of Easy FT Properties
Linearity Property
ax1(t) + bx2 (t)  aX1( jw ) + bX2 ( jw )
Delay Property
- jw t d
x(t - td )  e X( jw )
Frequency Shifting
jw 0 t
x(t)e  X( j(w - w 0 ))
Scaling
x(at)  1
|a| X( j( )) w
a
4/3/2024 © 2003, JH McClellan & RW Schafer 4
Table of FT Properties
x(t) *h(t)  H( jw )X( jw )
1
x(t)p(t)  X( jw )* P( jw )
2p
jw 0 t
x(t)e  X( j(w - w 0 ))
Differentiation Property
dx(t)
 ( jw )X( jw )
dt
4/3/2024 © 2003, JH McClellan & RW Schafer 5
Frequency Shifting Property
jw 0 t
x(t)e  X( j(w - w 0 ))
¥ ¥
- jw0 t - jw t - j (w - w 0 )t
ò e x(t )e dt = ò x(t)e dt
-¥ -¥
= X( j(w - w 0 ))
sin 7t jw 0 t 1 w 0 -7 < w < w 0 +7
y(t) = e  Y( jw ) = 
pt 0 elsewhere
4/3/2024 © 2003, JH McClellan & RW Schafer 6
Convolution Property
x(t) y(t) = h(t) * x(t)

X( jw ) Y( jw ) = H( jw )X( jw )
 Convolution in the time-domain
¥
y(t) = h(t) * x(t) = ò h( t )x(t - t )d t

corresponds to MULTIPLICATION in the
frequency-domain Y( jw ) = H( jw )X( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 7
Cosine Input to LTI System
Y (j w ) = H( jw )X(j w )
= H( jw )[pd (w - w 0 ) + pd (w + w 0 )]
= H( jw 0 ) pd (w - w 0 ) + H( - jw 0 ) pd (w + w 0 )
jw 0 t - jw 0t
y(t) = H (j w 0 ) e + H( - j w 0 ) e
1
2
1
2
1 jw0 t * 1 - jw0 t
= H( jw 0 ) 2 e + H ( jw 0 ) 2 e
= H( jw 0 ) cos(w 0t + H( jw 0 ))
4/3/2024 © 2003, JH McClellan & RW Schafer 8
Ideal Lowpass Filter

Hlp ( jw )

- w co w co
y(t) = x(t) if w 0 < w co
y(t) = 0 if w 0 > w co
4/3/2024 © 2003, JH McClellan & RW Schafer 9
Ideal LPF: Fourier Series
ì 1 w < w co
H( jw ) = í
î 0 w > w co

f co "cutoff freq."

4 4
y(t) = sin(50pt ) + sin (150pt )
p 3p

4/3/2024 © 2003, JH McClellan & RW Schafer 10


The way communication
systems work

How do we share
bandwidth ?

4/3/2024 © 2003, JH McClellan & RW Schafer 11


Table of FT Properties
x(t) *h(t)  H( jw )X( jw )
1
x(t)p(t)  X( jw )* P( jw )
2p
jw 0 t
x(t)e  X( j(w - w 0 ))
Differentiation Property
dx(t)
 ( jw )X( jw )
dt
4/3/2024 © 2003, JH McClellan & RW Schafer 12
Signal Multiplier (Modulator)
x(t) y(t) = p(t)x(t)
X( jw ) Y( jw ) =
1
X( jw ) * P( jw )
2p
p(t)

 Multiplication in the time-domain corresponds to


convolution in the frequency-domain.

1 ¥
Y( jw ) = ò X( jq )P( j(w - q ))dq
4/3/2024
2p - ¥
© 2003, JH McClellan & RW Schafer 13
y (t )  x (t ) p(t )  Y ( j )  1
2 X ( j )  P( j )

p(t )  cos(ct ) 
P( j)   (  c )   (  c )

y (t )  x(t ) cos(ct ) 
Y ( j)  1
2 X ( j)   (  c )   (  c )

Y ( j )  12 X ( j (  c ))  12 X ( j (  c ))
4/3/2024 © 2003, JH McClellan & RW Schafer 14
Amplitude Modulator
x(t) y(t) = x(t)cos(w c t)
X( jw ) Y( jw ) =
1
X( j(w - w c ))
2
cos(w ct)
1
+ X( j(w + w c ))
2

 x(t) modulates the amplitude of the cosine


wave. The result in the frequency-domain
is two shifted copies of X(j).
4/3/2024 © 2003, JH McClellan & RW Schafer 15
y (t )  x(t ) cos(ct ) 
Y ( j)  12 X ( j(  c ))  12 X ( j(  c ))


1 t T sin( T )
x (t )    X ( j )  2
 t T ( )
0

y (t )  x(t ) cos(ct ) 
sin((  c )T ) sin((  c )T )
Y ( j )  
(  c ) (  c )
4/3/2024 © 2003, JH McClellan & RW Schafer 16
y (t )  x(t ) cos(ct ) 
Y ( j)  12 X ( j(  c ))  12 X ( j(  c ))
x(t)

1
2 X ( j (  c )) 1
2 X ( j (  c ))

- wc wc
4/3/2024 © 2003, JH McClellan & RW Schafer 17
DSBAM Modulator

x(t) y(t) = x(t)cos(w c t)


X( jw ) Y( jw ) =
1
X( j(w - w c ))
2
cos(w ct)
1
+ X( j(w + w c ))
2

 If X(j)=0 for ||>b and c >b,the result


in the frequency-domain is two shifted and
scaled exact copies of X(j).
4/3/2024 © 2003, JH McClellan & RW Schafer 18
DSBAM Waveform

 In the time-domain, the “envelope” of sine-


wave peaks follows |x(t)|

4/3/2024 © 2003, JH McClellan & RW Schafer 19


Double Sideband AM (DSBAM)
“Typical”
bandlimited
input signal

Frequency-shifted
copies Upper sideband
Lower sideband

4/3/2024 © 2003, JH McClellan & RW Schafer 20


DSBAM DEmodulator

x(t) y(t) = x(t)cos(w ct) w(t) v(t)

cos(w ct) cos(w ct)

1 1
2
w(t) = x(t)[cos(w c t)] = x(t) + x(t)cos(2w c t)
2 2
1 1 1
W( jw ) = X( jw ) + X( j(w - 2w c )) + X( j(w + 2w c ))
2 4 4
V( jw ) = H( jw )W( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 21
DSBAM Demodulation

ì 2 | w | < w co
H( jw ) = í
î 0 | w | > w co

V( jw ) = H( jw )W( jw ) = X( jw ) if w b < w co < 2w c - w b


4/3/2024 © 2003, JH McClellan & RW Schafer 22
Frequency-Division
Multiplexing (FDM)
 Shifting spectrum of signal to higher
frequency:
 Permits transmission of low-frequency signals
with high-frequency EM waves
 By allocating a frequency band to each signal
multiple bandlimited signals can share the same
channel
 AM radio: 530-1620 kHz (10 kHz bands)
 FM radio: 88.1-107.9 MHz (200 kHz bands)

4/3/2024 © 2003, JH McClellan & RW Schafer 23


FDM Block Diagram (Xmitter)

cos(w c1t)

Spectrum of inputs
must be bandlimited
Need w c 2 - w c1 > 2w b
cos(w c 2t)

4/3/2024 © 2003, JH McClellan & RW Schafer w c1 w c2 24


Frequency-Division De-Mux

w c1 w c2

cos(w c1t)

cos(w c 2t)
4/3/2024 © 2003, JH McClellan & RW Schafer 25
Bandpass Filters for De-Mux

4/3/2024 © 2003, JH McClellan & RW Schafer 26


Pop Quiz: FT thru LPF
1 H LP ( j )

  co co 

Input x(t )  X ( j )   4  (  30 k )
k 

If the output is y (t )  2, then find a value for co


4/3/2024 © 2003, JH McClellan & RW Schafer 27
Signal Processing First

Lecture 25
Reconstruction from Samples

4/3/2024 © 2003, JH McClellan & RW Schafer 1


Ideal C-to-D Converter
• Mathematical Model for A-to-D

x[n] = x(nTs )
FOURIER
TRANSFORM
of xs(t) ???

4/3/2024 © 2003, JH McClellan & RW Schafer 2


Periodic Impulse Train

 
2p
p(t )   (t  nTs )   ak e jk st
ws =
Ts
n  k 
Ts / 2
1  jk s t 1 Fourier Series
ak 
Ts   (t )e dt 
Ts
4/3/2024
Ts / 2 © 2003, JH McClellan & RW Schafer 3
FT of Impulse Train
 
2
p(t )   (t  nTs )  P( j )    (  ks )
n  k  Ts

2
s 
Ts

4/3/2024 © 2003, JH McClellan & RW Schafer 4


Impulse Train Sampling

¥ ¥
xs (t) = x(t) å d (t - nTs ) = å x(t)d (t - nTs )
n= - ¥ n= - ¥
¥
xs (t) = å x(nTs )d (t - nTs )
4/3/2024 n= - ¥
© 2003, JH McClellan & RW Schafer 5
Illustration of Sampling
x(t)

t

xs ( t )   x(nTs ) (t  nTs )
n 
x[n] = x(nTs )

n
4/3/2024 © 2003, JH McClellan & RW Schafer 6
Sampling: Freq. Domain


  ak e jkst EXPECT
FREQUENCY
k  SHIFTING !!!
 
p(t )   (t  nTs )   ak e jk st

n  k 
4/3/2024 © 2003, JH McClellan & RW Schafer 7
Frequency-Domain Analysis
¥ ¥
xs (t) = x(t) å d (t - nTs ) = å x(nTs )d (t - nTs )
n= - ¥ n= - ¥
¥ 1 ¥
1 jkw st jkw st
xs (t) = x(t) å e = å x(t)e
Ts
k = - ¥ Ts k= - ¥

1 ¥
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥ 2p
ws =
Ts
4/3/2024 © 2003, JH McClellan & RW Schafer 8
Frequency-Domain
Representation of Sampling
“Typical”
bandlimited signal

1 ¥
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥

4/3/2024 © 2003, JH McClellan & RW Schafer 9


Aliasing Distortion
“Typical”
bandlimited signal

 If s < 2b , the copies of X(j) overlap,


and we have aliasing distortion.

4/3/2024 © 2003, JH McClellan & RW Schafer 10


Reconstruction of x(t)

¥
xs (t) = å x(nTs )d (t - nTs )
n= - ¥

1 ¥
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥
Xr ( jw ) = Hr ( jw )Xs ( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 11
Reconstruction: Frequency-Domain

If  s  2 b , the copies of
H r ( jw ) X ( j ) do not overlap, so
X r ( j )  H r ( j  ) X s ( j  )

4/3/2024 © 2003, JH McClellan & RW Schafer 12


Ideal Reconstruction Filter
ì Ts p
w <
ï Ts
H r ( jw ) = í p
ï0 w >
î Ts

p
sin T t hr (0) = 1
s
hr (t) = p
Ts
t

4/3/2024 © 2003, JH McClellan & RW Schafer 13


Signal Reconstruction
¥
xr (t) = hr (t) * xs (t) = hr (t)* å x(nTs )d (t - nTs )
n= - ¥
¥
xr (t) = å x(nTs )hr (t - nTs )
n= - ¥
p
¥ sin T (t - nTs )
s
xr (t) = å x(nTs ) p
n= - ¥ Ts
(t - nTs )
Ideal bandlimited interpolation formula
4/3/2024 © 2003, JH McClellan & RW Schafer 14
Shannon Sampling Theorem
 “SINC” Interpolation is the ideal
 PERFECT RECONSTRUCTION
 of BANDLIMITED SIGNALS

4/3/2024 © 2003, JH McClellan & RW Schafer 15


Reconstruction in Time-Domain

4/3/2024 © 2003, JH McClellan & RW Schafer 16


Ideal C-to-D and D-to-C

¥ sin Tp (t - nTs )
s
xr (t) = å x[n] p
x[n] = x(nTs ) n= - ¥ Ts
(t - nTs )
Ideal Sampler Ideal bandlimited interpolator

1 ¥ Xr ( jw ) = Hr ( jw )Xs ( jw )
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥
4/3/2024 © 2003, JH McClellan & RW Schafer 17
Signal Processing First

Lecture 26- Review:


Digital Filtering of Analog Signals

4/3/2024 © 2003, JH McClellan & RW Schafer 1


LECTURE OBJECTIVES
 Sampling Theorem Revisited
 GENERAL: in the FREQUENCY DOMAIN
 Fourier transform of sampled signal
 Reconstruction from samples

 Effective Frequency Response

 Important FT properties
 Convolution  multiplication
 Frequency shifting

4/3/2024 © 2003, JH McClellan & RW Schafer 3


Sampling: Freq. Domain


p(t )   ak e jk st EXPECT
FREQUENCY
k 
SHIFTING !!!
 
p(t )   (t  nTs )   ak e jk st

n  k 
4/3/2024 © 2003, JH McClellan & RW Schafer 4
Frequency-Domain
Representation of Sampling
“Typical”
bandlimited signal

1 ¥
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥

4/3/2024 © 2003, JH McClellan & RW Schafer 5


Aliasing Distortion
“Typical”
bandlimited signal

 If s < 2b , the copies of X(j) overlap,


and we have aliasing distortion.

4/3/2024 © 2003, JH McClellan & RW Schafer 6


Reconstruction of x(t)

¥
xs (t) = å x(nTs )d (t - nTs )
n= - ¥

1 ¥
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥
Xr ( jw ) = Hr ( jw )Xs ( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 7
Reconstruction: Frequency-Domain

If  s  2 b , the copies of
H r ( jw ) X ( j ) do not overlap, so
X r ( j )  H r ( j  ) X s ( j  )

4/3/2024 © 2003, JH McClellan & RW Schafer 8


Ideal Reconstruction Filter
ì Ts p
w <
ï Ts
H r ( jw ) = í p
ï0 w >
î Ts

p
sin T t hr (0) = 1
s
hr (t) = p
Ts
t

4/3/2024 © 2003, JH McClellan & RW Schafer 9


Signal Reconstruction
¥
xr (t) = hr (t) * xs (t) = hr (t)* å x(nTs )d (t - nTs )
n= - ¥
¥
xr (t) = å x(nTs )hr (t - nTs )
n= - ¥
p
¥ sin T (t - nTs )
s
xr (t) = å x(nTs ) p
n= - ¥ Ts
(t - nTs )
Ideal bandlimited interpolation formula
4/3/2024 © 2003, JH McClellan & RW Schafer 10
Shannon Sampling Theorem
 “SINC” Interpolation is the ideal
 PERFECT RECONSTRUCTION
 of BANDLIMITED SIGNALS

4/3/2024 © 2003, JH McClellan & RW Schafer 11


Reconstruction in Time-Domain

4/3/2024 © 2003, JH McClellan & RW Schafer 12


Ideal C-to-D and D-to-C

¥ sin Tp (t - nTs )
s
xr (t) = å x[n] p
x[n] = x(nTs ) n= - ¥ Ts
(t - nTs )
Ideal Sampler Ideal bandlimited interpolator

1 ¥ Xr ( jw ) = Hr ( jw )Xs ( jw )
Xs ( jw ) = å X( j(w - kw s ))
Ts
k= - ¥
4/3/2024 © 2003, JH McClellan & RW Schafer 13
DT Filtering of CT Signals
x(t) x[n] jwˆ y[n] y(t)
C-to-D H(e ) D-to-C
X( jw ) jwˆ jwˆ
Y( jw )
X(e ) Y(e )

If no aliasing occurs in sampling x(t), then it follows that

Y( jw ) = Heff ( jw )X( jw )
jwTs
ì H(e ) w < w s 1
2
Heff ( jw ) = í UNDEFINED
4/3/2024
î NOT0LTI w > 2ws
1
© 2003, JH McClellan & RW Schafer 14
DT Filtering of a CT Signal
Analog Input

Spectrum of
Discrete-Time Signal

̂
Digital Filter

̂
Reconstruction Filter
(Analog)


Analog Output

4/3/2024 © 2003, JH McClellan & RW Schafer 15


EFFECTIVE Freq. Response

 Assume NO Aliasing, then


 ANALOG FREQ <--> DIGITAL FREQ

wˆ = w Ts = w
fs
DIGITAL FILTER

 So, we can plot: jw Ts


 Scaled Freq. Axis H(e ) vs. w
ANALOG FREQUENCY

4/3/2024 © 2003, JH McClellan & RW Schafer 16


DIGITAL FILTER sin(11wˆ / 2)
jwˆ sin(wˆ / 2)
H(e )

f s = 1000 Hz
EFFECTIVE RESPONSE

Heff ( jw )

4/3/2024 © 2003, JH McClellan & RW Schafer 17


Heff for 11-pt Averager
 Frequency Response for Discrete-time
jˆ sin(11ˆ / 2)
H (e ) 
sin(ˆ / 2)

ˆ  Ts  
fs

 1000
 Analog Frequency Response
sin(11 / 2000 )
H ( j ) 
sin( / 2000 )
4/3/2024 © 2003, JH McClellan & RW Schafer 18
POP QUIZ

 Given:
-1
x(t) x[n] 2 + 2z y[n] y(t)
A-to-D -1 D-to-A
1 - 0.8z
 Find the output, y(t)
 When
x(t) = cos(2000p t)
f s = 5000Hz
4/3/2024 © 2003, JH McClellan & RW Schafer 19
POP QUIZ BECOMES

-1
 Given: 2 + 2z
H( z) = -1
1 - 0.8z
 Find the output, y[n]
 When
x[n] = cos(0.4p n)
 Because
wTs = 2000p / 5000 = 0.4p
NO Aliasing
4/3/2024 © 2003, JH McClellan & RW Schafer 20
SINUSOIDAL RESPONSE

 x[n] = SINUSOID => y[n] is SINUSOID


 Get MAGNITUDE & PHASE from H(z)
jˆ n
if x[n]  e then
jˆ jˆ n
y[n]  H (e )e
jˆ
where H (e )  H ( z ) z e jˆ
4/3/2024 © 2003, JH McClellan & RW Schafer 21
POP QUIZ INSIDE ANSWER
-1
 Given: 2 + 2z
H( z) = -1
1 - 0.8z
 The input: x[n] = cos(0.4p n)
 Then y[n]
y[n] = M cos(0.4p n + y )
- j0.4p
j 0.4p 2 + 2e - j 0.452 p
H(e )= - j 0.4p = 3.02e
1 - 0.8e
4/3/2024 © 2003, JH McClellan & RW Schafer 22
POP QUIZ ANSWER
 Given:
-1
x(t) x[n] 2 + 2z y[n] y(t)
A-to-D -1 D-to-A
1 - 0.8z
f s = 5000Hz
 When x(t) = cos(2000p t)
 The output is

y(t) = 3.02 cos(2000p t - 0.452p )


4/3/2024 © 2003, JH McClellan & RW Schafer 23
ANOTHER INPUT FREQ

 Given: wˆ = ?
-1
x(t) x[n] 2 + 2z y[n] y(t)
A-to-D -1 D-to-A
1 - 0.8z
 Find the output, y(t)
x(t )  cos(2 (7500)t )
 When

wˆ = ?
f s = 5000Hz
4/3/2024 © 2003, JH McClellan & RW Schafer 24
2nd POP QUIZ ANSWER
ˆ  cos(2 (7500) / 5000  2 (1.5)
 Given:
-1
x(t) x[n] 2 + 2z y[n] y(t)
A-to-D -1 D-to-A
1 - 0.8z
w =?
 When
x(t )  cos(2 (7500)t )
ˆ  3
f s = 5000Hz y(t) = ?
4/3/2024 © 2003, JH McClellan & RW Schafer 25
IMPORTANT CONCEPTS
 ALL Signals have Frequency Content
 Sum of Sinusoids
 Complex Exponentials
 Impulses, Square Pulses
 FILTERS alter the Frequency Content
 Image Processing Example: Blur
 Linear Time-Invariant Processing
 3 Domains for Analysis

4/3/2024 © 2003, JH McClellan & RW Schafer 26


Superficial Knowledge

 It depends how carefully you think about


it. If you don’t think very carefully it’s
obvious; but if you think about it in
depth, you’ll get confused and it won’t
be obvious.
…anon

4/3/2024 © 2003, JH McClellan & RW Schafer 27


THREE DOMAINS

H( z) =
å bz
k
-k

1- å a z
-
jwˆ
z=e

4/3/2024 © 2003, JH McClellan & RW Schafer 28


THE FUTURE

 Circuits & Laplace Transforms


Polynomials: Poles & Zeros
H(s)

h(t) H( jw )
Implementation is Frequency
RLC-op-amp circuit Response

4/3/2024 © 2003, JH McClellan & RW Schafer 29


Mathematical Elegance

1 ¥
jw t Fourier Synthesis
x(t) = ò X( jw )e dw (Inverse Transform)
2p - ¥

¥
- jw t
X( jw ) = ò x(t)e dt Fourier Analysis
-¥ (Forward Transform)

Time - domain  Frequency - domain


x(t)  X( jw )
4/3/2024 © 2003, JH McClellan & RW Schafer 30

You might also like