You are on page 1of 4

# ECE 468

LAB # 4
SPRING 07
DISCRETE TIME FOURIER TRANSFORM (DTFT)
-Frequency Response

Objective: The function freqz can be used to compute the values of the DTFT of a
sequence, described as a rational function in e jw at a prescribed set of discrete frequency
points.
b1 b2 e j bM 1e jM
Y e j
H e j

X e j
a1 a 2 e j a N 1e jN

## Also the frequency response of a system of the form of

N 1

M 1

k 1

k 1

ak yn k 1 bk xn k 1

## can be computed using freqz function.

Commands:
FREQZ: Compute the frequency response of digital filters.
When N is an integer, [H,W] = FREQZ(B,A,N) returns the N-point frequency
vector W in radians and the N-point complex frequency response vector H
of the filter B/A:
Y e jw
b1 b2e jw bm 1e jmw
jw
He

X e jw
a1 a2e jw an 1e jnw
given numerator and denominator coefficients in vectors B and A. The frequency
response is evaluated at N points equally spaced around the upper half of the unit
circle. If N isn't specified, it defaults to 512.

## [H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle.

H = FREQZ(B,A,W) returns the frequency response at frequencies designated in
vector W, in [radians/sample] (normally between 0 and pi).
REAL: Complex real part.
REAL(X) is the real part of X.
See I or J to enter complex numbers.
IMAG: Complex imaginary part.
IMAG(X) is the imaginary part of X.
See I or J to enter complex numbers.
ABS: Absolute value.
ABS(X) is the absolute value of the elements of X. When X is complex, ABS(X) is the
complex modulus (magnitude) of the elements of X.

## ANGLE: Phase angle.

ANGLE(H) returns the phase angles, in radians, of a matrix with complex elements.
GTEXT: Place text with mouse.
GTEXT('string') displays the graph window, puts up a cross-hair, and waits for a
mouse button or keyboard key to be pressed. The cross-hair can be positioned with the
mouse (or with the arrow keys on some computers). Pressing a mouse button or any
key writes the text string onto the graph at the selected location.
Note: Frequency response H (e jw ) is complex so we can not plot it. So we plot real
part, imaginary part, magnitude spectrum and phase spectrum of H (e jw ) with
respect to frequency or normalized frequency.
Normalized frequency is a dimensionless quantity, obtained by taking the ratio between
an actual frequency and a reference value, or a nominal value. In this exercise , reference
value is pi.
Exercise:
1. Plot the following DTFT with respect to normalized frequency. You need to plot 4
graphs (the real part, the imaginary part, the magnitude spectrum, and the phase
spectrum) on a sheet of paper. (Use subplot, plot, title and gtext commands.) Given
W=0:pi/N:pi; N=256.

He

## 0.008 0.033e j 0.05e j 2 0.033e j 3 0.008e j 4

1 2.37e j 2.7e j 2 1.6e j 3 0.41e j 4

2. Find the N-point frequency vector (W) and plot the frequency response of the
following system with respect to normalized frequency. You need to plot 4 graphs (the
real part, the imaginary part, the magnitude spectrum, and the phase spectrum) on a sheet
of paper. (Use subplot, plot, title and gtext commands.) Take N=512.

## yn 0.7 yn 1 0.45 yn 2 0.6 yn 3

0.8xn 0.44 xn 1 0.36 xn 2 0.02 xn 3
Note:
Submit MATLAB code and 4 graphs for Exercise 1 and 2.
Dont look into others screens.
Please delete your programs in the computer where you work. You will be responsible if
anyone copies your program. Zero points will be given to all similar programs, No matter
who copied.

Appendix

x[n]e

jwn

Impulse response

x[n]

h(n)

Therefore H e jw

Y e jw
X e jw

## Given system response is

N 1

M 1

k 1

k 1

ak yn k 1 bk xn k 1

## System response can be written as

a1 y[n] a2 y[n 1] ...... a N 1 y[n N ] b1 x[n] b2 x[n 1] ... bM 1 x[n M ]
Apply Fourier transform both sides
a1Y [e jw ] a2Y [e jw ]e jw1 ...... a N 1Y [e jw ]e jwN b1 X [e jw ] b2 X [e jw ]e jw1 ... bM 1 X [e jw ]e jwM
jw
jw
Make Y [e ] common on left hand side and X [e ] on right hand side

## Therefore Fourier transform of unit impulse response H [e jw ] is given by

b1 b2 e j bM 1e jM
Y e jw
F h[n] H e jw

X e jw
a1 a 2 e j a N 1e jN

0.03

Exercise 1
0.015

0.02

0.01

0.01

0.005

0.5
Normalized frequency
Magnitude spectrum of H

1.5

0.02

0.5
Normalized frequency
Phase spectrum of H

0.5
Normalized frequency

Ph(H)

0.03

0.01

0.5

0.5
Normalized frequency
real part of H

1
Exercise 2
6

2
0
-2

2
0

0.5
Normalized frequency
magnitude spectrum of H

-2

Ph(H)

Mag(H)

imaginary part of H

Im(H)

Re(H)

Mag(H)

Imaginary part of H

Im(H)

Re(H)

Real part of H

4
2
0

0.5
Normalized frequency
Phase spectrum of H

0.5
Normalized frequency

1
0

0.5
Normalized frequency

-1