DSP Lab 1 Handout
DSP Lab 1 Handout
Islamabad
Remarks: ……………………………………………
𝑦[𝑛] = ∑ ℎ[𝑘]𝑥[𝑛 − 𝑘]
𝑘=−∞
∞
Or can be represented as
𝑦[𝑛] = ℎ[𝑛] ⊛ 𝑥[𝑛]
The following MATLAB program illustrates this approach.
% Program P1_6
close all; clear all; clc
h= [3 2 1 -2 1 0 -4 0 3]; % impulse response
x = [1 -2 3 -4 3 2 1]; % input sequence
y = conv(h,x); n = 0:14;
subplot(2,1,1); stem(n,y);
xlabel('Time index n'); ylabel('Amplitude');
title('Output Obtained by Convolution');grid;
x1 = [x zeros(1,8)];
y1 = filter(h,1,x1);
subplot(2,1,2); stem(n,y1);
xlabel('Time index n'); ylabel('Amplitude');
title('Output Generated by Filtering');grid;
3.7 Stability of LTI Systems
As indicated, an LTI discrete-time system is BIBO stable if its impulse response is absolutely sum
able. It therefore follows that a necessary condition for an IIR LTI system to be stable is that its
impulse response decays to zero as the sample index gets larger. Program P1_7 is a simple
MATLAB program used to compute the sum of the absolute values of the impulse response
samples of a causal IIR LTI system. It computes N samples of the impulse response sequence,
evaluates
𝐾
𝑆(𝐾) = ∑|ℎ[𝑛]|
𝑛=0
1 Run the Program P1_8 for M = 2 to generate the output signal with x[n] = s1[n] + s2[n] as the input.
Which component of the input x[n] is suppressed by the discrete-time system simulated by this
program?
2 If the LTI system is changed from y[n] = 0.5(x[n] + x[n - 1]) to y[n] = 0.5(x[n] - x[n - 1]), what
would be its effect on the input x[n] = s1[n] + s2[n]?
3 Run Program P1_8 for other values of filter length M, and various values of the frequencies of the
sinusoidal signals s1[n] and s2[n]. Comment on your results.
4 Use sinusoidal signals with different frequencies as the input signals and compute the output signal
for each input. How do the output signals depend on the frequencies of the input signal?
5 Run Program P1_3 and compare y[n] obtained with weighted input with yt[n] obtained by
combining the two outputs y1[n] and y2[n] with the same weights. Are these two sequences equal?
Is this system linear?
6 Consider another system described by: y[n] = x[n] x[n − 1].
Modify Program P1_3 to compute the output sequences y1[n], y2[n], and y[n] of the above system.
Compare y[n] with yt[n]. Are these two sequences equal? Is this system linear?
7 Run Program P1_4 and compare the output sequences y[n] and yd[n - 10]. What is the relation
between these two sequences? Is this system time-invariant?
8 Consider another system described by
Modify Program P1_4 to simulate the above system and determine whether this system is time-
invariant or not.