LABEX2
LABEX2
Section:
Laboratory Exercise 2
DISCRETE-TIME SYSTEMS: TIME-DOMAIN REPRESENTATION
% Program P2_1
n = 0:100;
x = s1+s2;
num = ones(1,M);
y = filter(num,1,x)/M;
clf;
subplot(2,2,1);
plot(n, s1);
title('Signal #1');
1
subplot(2,2,2);
plot(n, s2);
title('Signal #2');
subplot(2,2,3);
plot(n, x);
title('Input Signal');
subplot(2,2,4);
plot(n, y);
title('Output Signal');
axis;
Answers:
Q2.1 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.
2
Signal #1 Signal #2
2 2
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
0 50 100 0 50 100
Time index n Time index n
Input Signal Output Signal
2 2
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
0 50 100 0 50 100
Time index n Time index n
Q2.2 Program P2_1 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. >
Q2.3 Program P2_1 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.
From these plots we make the following observations -
< Insert MATLAB figure(s)s here. Copy from figure window(s)s and
paste. >
Q2.4 The required modifications to Program P2_1 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 (see Program P1_7) are listed below :
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
3
The results of Questions Q2.1 and Q2.2 from the response of this system to the
swept-frequency signal can be explained as follows :
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.5 The sinusoidal signals with the following frequencies as the input signals were
used to generate the output signals :
The output signals generated for each of the above input signals are displayed
below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The output signals depend on the frequencies of the input signal according to the
following rules:
Q2.6 The output signal generated by using sinusoidal signals of the form x[n] =
sin(on) + K as the input signal is shown below for the following values of o
and K-
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The dependence of the output signal yt[n] on the DC value K can be explained
as -
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.7 The outputs y[n], obtained with weighted input, and yt[n], obtained by
combining the two outputs y1[n] and y2[n] with the same weights, are shown
below along with the difference between the two signals :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
4
The two sequences are -
The system is -
Q2.8 Program P2_3 was run for the following three different sets of values of the
weighting constants, a and b, and the following three different sets of input
frequencies:
The plots generated for each of the above three cases are shown below :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Based on these plots we can conclude that the system with different weights is -
Q2.9 Program 2_3 was run with the following non-zero initial conditions -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Based on these plots we can conclude that the system with nonzero initial
conditions is -
Q2.10 Program P2_3 was run with nonzero initial conditions and for the following three
different sets of values of the weighting constants, a and b, and the following
three different sets of input frequencies :
The plots generated for each of the above three cases are shown below :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Based on these plots we can conclude that the system with nonzero initial
conditions and different weights is -
y[n] = x[n]x[n–1]
The output sequences y1[n], y2[n],and y[n]of the above system generated
by running the modified program are shown below :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Comparing y[n] with yt[n] we conclude that the two sequences are -
This system is -
5
Project 2.4 Time-invariant and Time-varying Systems
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.12 The output sequences y[n] and yd[n-10] generated by running Program P2_4
are shown below -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
Q2.13 The output sequences y[n] and yd[n-D] generated by running Program P2_4 for
the following values of the delay variable D -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
Q2.14 The output sequences y[n] and yd[n-10] generated by running Program P2_4
for the following values of the input frequencies -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
Q2.15 The output sequences y[n] and yd[n-10] generated by running Program P2_4
for non-zero initial conditions are shown below -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
6
Q2.16 The output sequences y[n] and yd[n-10] generated by running Program P2_4
for non-zero initial conditions and following values of the input frequencies -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
is given below:
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
Q2.18 (optional) The modified Program P2_3 to test the linearity of the system of Q2.18 is
shown below:
< Insert program code here. Copy from m-file(s) and paste. >
The outputs y[n]and yt[n] obtained by running the modified program P2_3 are
shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The system is -
7
A copy of Program P2_5 is shown below:
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.19 The first 41 samples of the impulse response of the discrete-time system of Project
2.3 generated by running Program P2_5 is given below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.20 The required modifications to Program P2_5 to generate the impulse response of
the following causal LTI system :
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.21 The MATLAB program to generate the impulse response of a causal LTI system of
Q2.20 using the filter command is indicated below:
< Insert program code here. Copy from m-file(s) and paste. >
The first 40 samples of the impulse response generated by this program are shown
below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Comparing the above response with that obtained in Question Q2.20 we conclude
-
Q2.22 The MATLAB program to generate and plot the step response of a causal LTI
system is indicated below:
< Insert program code here. Copy from m-file(s) and paste. >
The first 40 samples of the step response of the LTI system of Project 2.3 are
shown below:
8
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.23 The output sequences y[n], y2[n], and the difference signal d[n] generated
by running Program P2_6 are indicated below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.24 The sequences generated by running Program P2_6 with the input changed to a
sinusoidal sequence are as follows :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.25 The sequences generated by running Program P2_6 with non-zero initial condition
vectors are now as given below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.26 The modified Program P2_6 with the two 2nd-order systems in reverse order and
with zero initial conditions is displayed below :
< Insert program code here. Copy from m-file(s) and paste. >
The sequences generated by running the modified program are sketched below :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
Q2.27 The sequences generated by running the modified Program P2_6 with the two 2nd-
order systems in reverse order and with non-zero initial conditions are displayed
below:
9
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.28 The sequences y[n] and y1[n] generated by running Program P2_7 are shown
below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The reason for using x1[n] as the input, obtained by zero-padding x[n], for
generating y1[n] is -
Q2.29 The modified Program P2_7 to develop the convolution of a length-15 sequence
h[n] with a length-10 sequence x[n]is indicated below:
< Insert program code here. Copy from m-file(s) and paste. >
The sequences y[n] and y1[n] generated by running modified Program P2_7
are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
10
Q2.31 The purpose of the break command is -
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
From this value and the shape of the impulse response we can conclude that the
system is -
By running Program P2_8 with a larger value of N the new value of | h(K)| is -
Q2.33 The modified Program P2_8 to simulate the discrete-time system of Q2.33 is given
below:
< Insert program code here. Copy from m-file(s) and paste. >
The impulse response generated by running the modified Program P2_8 is shown
below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
From this value and the shape of the impulse response we can conclude that the
system is -
< Insert program code here. Copy from m-file(s) and paste. >
Answers:
Q2.34 The output sequences generated by this program are shown below :
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The filter with better characteristics for the suppression of the high frequency
component of the input signal x[n] is -
11
Q2.35 The required modifications to Program P2_9 by changing the input sequence to a
swept sinusoidal sequence (length 301, minimum frequency 0, and maximum
frequency 0.5) are listed below along with the output sequences generated by the
modified program:
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >
The filter with better characteristics for the suppression of the high frequency
component of the input signal x [n] is -
Date: Signature:
12