You are on page 1of 6

DSP Lab # 10 18-04-2017

Discrete Time Fourier Transform (DTFT)

Objective:

The objective of this lab is to understand the frequency domain signal representation and
the operation of Discrete Time Fourier Transform (DTFT) and its computational aspects
via MATLAB. We will comprehend why the response to a complex exponential lead to
frequency response H(ejw) of a system and how it describes a system in frequency
domain.

Discrete Time Fourier Transform (DTFT):


The Z-Transform of a sequence that was given by:

() = {()} = ()
=

Where z is a complex variable. The set of z values for which X (z) exists is called the
region of convergence (ROC). To recover x[] from X(), we use the inverse Z-
transform. Now the Discrete Time Fourier Transform (DTFT) of a sequence is when Z=
j .
The Discrete Time Fourier Transform (DTFT) X( j ) of a sequence "x(n)" is defined by:

( ) = ()( jn)
j

In general "X( j )" is a complex function of the real variables "" and can be written as:

Where "Xre( j )" and "Xim( j )" are, respectively, the real and imaginary parts of "X( j )",
and can be alternately be expressed in the form:

Where

() = arg{( j )}

The quantity "|X( j )|" is called the magnitude function and the quantity "()" is called
the phase function, with both functions again being real functions of "". In many
applications, the Fourier Transform is called the Fourier Spectrum and likewise,
"|X( j )|" and "()" are referred to the magnitude spectrum and phase spectrum,
respectively.
DSP Lab # 10 18-04-2017

The Discrete Time Fourier Transform (DTFT) "X( j )" of a sequence "x(n)" is a
continuous function "". Since the data in MATLAB is in vector form, "X( j )" can only
be evaluated at a prescribed set of discrete frequencies. Moreover, only a class of DTFT
that is expressed as a rational function in " j " in the form, given below, can be
evaluated.

The DTFT "X( j )" of a sequence "x(n)" in the form of rational function can be
computed easily at a prescribed set of "L" discrete frequency point = , using the
MATLAB function "freqz". For faster computation, "L" should be chosen as a power of
2, such as 256, or 512.

clf; %Clear all figures


clear all; %Clear all variables
close all; %Close all figures
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [2 1]; %Nominator coefficients
den = [1 -0.6]; %Denominator coefficients
h = freqz(num, den, w); %Compute DTFT
% Plot the DTFT
subplot(2,1,1);
plot(w/pi,real(h));
grid;
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
figure(1);
subplot(2,1,2);
plot(w/pi,imag(h));
grid;
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
figure(2);
subplot(2,1,1);
plot(w/pi,abs(h));
grid;
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2);
plot(w/pi,angle(h));
grid;
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');
ylabel('Phase,radians');
DSP Lab # 10 18-04-2017

Real part of H(ej )


8

Amplitude 6

0
-4 -3 -2 -1 0 1 2 3 4
/
Imaginary part of H(ej )
4

2
Amplitude

-2

-4
-4 -3 -2 -1 0 1 2 3 4
/

Magnitude Spectrum |H(ej )|


8

6
Amplitude

0
-4 -3 -2 -1 0 1 2 3 4
/
Phase Spectrum arg[H(ej )]
2
Phase,radians

-1

-2
-4 -3 -2 -1 0 1 2 3 4
/
DSP Lab # 10 18-04-2017

symsjwpositive
symsn;
a=-0.5^n;
L=-30, U=60;
a=a*exp(-1i*w*n);
xjw=symsum(a,n,L,U);
pretty(xjw);
f=inline(xjw);
w=-2*pi:0.1:2*pi;
y=f(w);
figure
plot(w,abs(y))
title('Magnitude Response')
xlabel('Frequencies ----->')
ylabel('Magnitude ----->')
grid on, axis tight
figure
plot(w,angle(y))
title('Phase Response')
xlabel('Frequencies ----->')
ylabel('Phase ----->')
grid on, axis tight
DSP Lab # 10 18-04-2017

9 Magnitude Response
x 10

1.8

1.6
Magnitude ----->

1.4

1.2

0.8

-6 -4 -2 0 2 4 6
Frequencies ----->

Phase Response
3

1
Phase ----->

-1

-2

-3
-6 -4 -2 0 2 4 6
Frequencies ----->
DSP Lab # 10 18-04-2017

The following expression of DTFT can also be used in MATLAB to evaluate the magnitude
and phase response of sequence.

( j ) = ()( jn) )
=

= =
j
( ) = () cos(n) () jsin(n)
= =

You can manually evaluate both the real and imaginary parts in MATLAB separately.

Lab Task
1. Evaluate in the range 0 the following DTFT:

2. Generate a linearly increasing chirp signal of your own choice and plot its magnitude and
phase response. Your observations?

3. Add three cosine signals of frequencies 2, 5 & 10 Hz and name that signal as T. Could you
find these frequencies by frequency domain analysis of T? Now add some random noise in T
and observe the Magnitude and Phase Spectrums.

4. Perform Amplitude Modulation XA of two signals x1 & x2 as shown below. Plot the
Magnitude Spectrum of XA. Look at the frequency components that are present in XA and
justify them using mathematics.

f1=5;
f2=100;
Em=4;
Ec=2;
x1=Em*sin(2*pi*f1*t);
x2=Ec*sin(2*pi*f2*t);
XA=(x1.*sin(2*pi*f2*t))+(x2);

You might also like