You are on page 1of 11

Laboratory Exercise 3

LINEAR, TIME-INVARIANT DISCRETE-TIME SYSTEMS: FREQUENCY-


DOMAIN & TIME DOMAIN REPRESENTATIONS

Project 3.1 Transfer Function Analysis

A copy of Program P3_1 to compute and plot the magnitude and phase spectra of a moving average filter of Eq.

y[n] + 0.71y[n-1] – 0.46y[n-2] – 0.62y[n-3] = 0.9x[n] – 0.45x[n-1] + 0.35x[n-2] + 0.002x[n-3] for 0  2 is given
below:

% Program P3_1
% Evaluation of the DTFT
clf;
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [2 1];den = [1 -0.6];
h = freqz(num, den, w);
% 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');
subplot(2,1,2)
plot(w/pi,imag(h));grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
pause
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 in radians');

Answers:

Q3.1 The plots of the corresponding frequency responses are shown below:
Real part of H(ej )
8

Amplitude 4

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 in radians

-1

-2
-4 -3 -2 -1 0 1 2 3 4
 /
The types of symmetries exhibited by the magnitude and phase spectra are due to – the value of omega

The type of filter represented by the moving average filter is – low pass filter

3.2 TYPES OF TRANSFER FUNCTIONS

Project 3.2 Filters

A copy of Program P3_2 is given below:


% Impulse Response of Truncated Ideal Lowpass Filter
clf; % clear the current graph
fc = 0.25; % select the cutoff frequency
n = [-6.5:1:6.5]; % assign n to value from -6.5 to 6.5
y = 2*fc*sinc(2*fc*n); % calculate o/p
k = n+6.5; % for getting value of 0,1,2...
stem(k,y); % plot the graph
title('N = 13'); % label the graph
axis([0 13 -0.2 0.6]); % assign the range of axis of graph
xlabel('Time index n'); % label the x-axis
ylabel('Amplitude'); % label the x-axis
grid; % show the grid in graph

Answers:

Q3.2 The plot of the impulse response of the approximation to the ideal lowpass filter obtained using Program P3_2 is
shown below:
N = 13
0.6

0.5

0.4

0.3
Amplitude

0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12
Time index n
The length of the FIR lowpass filter is - 13

The statement in Program P3_2 determining the filter length is – k=n+6.5

The parameter controlling the cutoff frequency is - fc

Q3.3 The required modifications to Program P3_2 to compute and plot the impulse response of the FIR lowpass filter of
Project 3.2 with a length of 20 and a cutoff frequency of c = 0.45 are as indicated below:

% Impulse Response of Truncated Ideal Lowpass Filter


clf;
fc = 0.45;
n = [-9.5:1:9.5];
y = 2*fc*sinc(2*fc*n);k = n+9.5;
stem(k,y);title('N = 20');
axis([0 19 -0.2 0.7]);
xlabel('Time index n');
ylabel('Amplitude');
grid;

The plot generated by running the modified program is given below:

N = 20
0.7

0.6

0.5

0.4
Amplitude

0.3

0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12 14 16 18
Time index n
Q3.4 The required modifications to Program P3_2 to compute and plot the impulse response of the FIR lowpass filter of
Project 3.2 with a length of 15 and a cutoff frequency of c = 0.65 are as indicated below:

clf;
fc = 0.65;
n = [-7.5:1:7.5];
y = 2*fc*sinc(2*fc*n);k = n+7.5;
stem(k,y);
title('N = 15');
axis([0 15 -0.5 1.5]);
xlabel('Time index n');
ylabel('Amplitude');
grid;

The plot generated by running the modified program is given below:

N = 15
1.5

1
Amplitude

0.5

-0.5
0 5 10 15
Time index n

Q3.5 A copy of Program P3_3 is given below:

< Insert program code here. Copy from m-file(s) and paste. >

A plot of the gain response of a length-2 moving average filter obtained using Program P3_3 is shown below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
From the plot it can be seen that the 3-dB cutoff frequency is at –

Q3.6 The required modifications to Program P3_3 to compute and plot the gain response of a cascade of K length-2
moving average filters are given below:

< Insert program code here. Copy from m-file(s) and paste. >

The plot of the gain response for a cascade of 3 sections obtained using the modified program is shown below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From the plot it can be seen that the 3-dB cutoff frequency of the cascade is at -

Q3.7 A copy of Program P3_4 is given below:

< Insert program code here. Copy from m-file(s) and paste. >

The plots of the impulse responses of the four FIR filters generated by running Program P3_4 are given below :

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From the plots we make the following observations:

Filter #1 is of length __________ with a __________ impulse response and is therefore a Type __ linear-
phase FIR filter.

Filter #2 is of length __________ with a __________ impulse response and is therefore a Type __ linear-
phase FIR filter.

Filter #3 is of length __________ with a __________ impulse response and is therefore a Type __ linear-
phase FIR filter.

Filter #4 is of length __________ with a __________ impulse response and is therefore a Type __ linear-
phase FIR filter.

From the zeros of these filters generated by Program P3_4 we observe that:

Filter #1 has zeros at z =

Filter #2 has zeros at z =

Filter #3 has zeros at z =

Filter #4 has zeros at z =


Q3.8 The modified program to plot the phase response of each of these filters is given below:

< Insert program code here. Copy from m-file(s) and paste. >

Plots of the phase response of each of these filters obtained using MATLAB are shown below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we conclude that each of these filters have __________ phase.

The group delay of Filter # 1 is -

The group delay of Filter # 2 is -

The group delay of Filter # 3 is -

The group delay of Filter # 4 is -

3.3 STABILITY TEST

A copy of Program P3_5 is given below:

< Insert program code here. Copy from m-file(s) and paste. >

Answers:

Q3.9 A plot of the magnitude response of H1(z) obtained using MATLAB is shown below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From this plot we observe that the magnitude response has a maximum at  = with a value =

Q3.10 Using Program P3_5 we tested the stability of H1(z) and arrive at the following stability test parameters {ki}:

From these parameters we conclude that H1(z) is _____________ .

Using Program P3_5 we tested the stability of H2(z) and arrive at the following stability test parameters {ki}:

From these parameters we conclude that H2(z) is _____________ .

Q3.11 Using Program P3_5 we tested the root locations of D(z) and arrive at the following stability test parameters {ki}:

From these parameters we conclude that all roots of D(z) are ________ the unit circle.

3.4 SIMULATION OF DISCRETE-TIME SYSTEMS

Project 3.4 The Moving Average System


A copy of Program P3_6 is given below:

< Insert program code here. Copy from m-file(s) and paste. >

Answers:

Q3.12 The output sequence generated by running the above program for M = 2 with x[n] = s1[n]+s2[n] as the input
is shown below.

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

The component of the input x[n] suppressed by the discrete-time system simulated by this program is -

Q3.13 Program P3_6 is modified to simulate the LTI system y[n] = 0.5(x[n]–x[n–1]) and process the input x[n] =
s1[n]+s2[n] resulting in the output sequence shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

The effect of changing the LTI system on the input is -


Q3.14 Program P3_6 is run for the following values of filter length M and following values of the frequencies of the
sinusoidal signals s1[n] and s2[n]. The output generated for these different values of M and the frequencies are
shown below.

For M=10 & fL=0.05 & fh =0.47

For M=2 & fL=0.02 & fh =0.47

For M=2 & fL=0.05 & fh =0.67

< Insert MATLAB figure(s)s here. Copy from figure window(s)s and paste. >

From these plots we make the following observations -


Q3.15 The required modifications to Program P3_6 by changing the input sequence to a swept-frequency sinusoidal
signal (length 101, minimum frequency 0, and a maximum frequency 0.5) as the input signal are listed below :

< Insert program code here. Copy from m-file(s) and paste. >

The output signal generated by running this program is plotted below.

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

The results of Questions Q3.12 and Q3.13 from the response of this system to the swept-frequency signal can be
explained as follows:

3.5 DISCRETE-TIME FOURIER TRANSFORM

Project 3.5 DTFT Computation


A copy of Program P3_7 is given below:

< Insert program code here. Copy from m-file(s) and paste. >

Answers:

Q3.16 The expression of the DTFT being evaluated in Program P3_7 is -

The function of the pause command is -

Q3.17 The plots generated by running Program P3_7 are shown below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

The DTFT is a ___________ function of .

Its period is -

The types of symmetries exhibited by the four plots are as follows:

Project 3.6 DTFT Properties

Answers:

Q3.18 The modified Program P3_8 created by adding appropriate comment statements, and adding program statements
for labeling the two axes of each plot being generated by the program is given below:

< Insert program code here. Copy from m-file(s) and paste. >

The parameter controlling the amount of time-shift is -

Q3.19 The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.20 Program P3_8 was run for the following value of the time-shift -

The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.21 Program P3_8 was run for the following values of the time-shift and for the following values of length for the
sequence -

The plots generated by running the modified program are given below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.22 The modified Program P3_9 created by adding appropriate comment statements, and adding program statements
for labeling the two axes of each plot being generated by the program is given below:

< Insert program code here. Copy from m-file(s) and paste. >

The parameter controlling the amount of frequency-shift is -

Q3.23 The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.24 Program P3_9 was run for the following value of the frequency-shift -

The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.25 Program P3_9 was run for the following values of the frequency-shift and for the following values of length for
the sequence -

The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.26 The modified Program P3_10 created by adding appropriate comment statements, and adding program statements
for labeling the two axes of each plot being generated by the program is given below:

< Insert program code here. Copy from m-file(s) and paste. >

Q3.27 The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >

From these plots we make the following observations:

Q3.28 Program P3_10 was run for the following two different sets of sequences of varying lengths -

The plots generated by running the modified program are given below:

< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
From these plots we make the following observations:

Date: Signature:

You might also like