LB 2
LB 2
Section:
Laboratory Exercise 2
DISCRETE-TIME SYSTEMS: TIME-DOMAIN REPRESENTATION
2.1 SIMULATION OF DISCRETE-TIME SYSTEMS
Amplitude
Amplitude
Amplitude
Amplitude
The component of the input x[n] suppressed by the discrete-time system simulated by this
program is – Signal 2 with higher frequency of 0.47 This filter is maybe a LPF.
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:
3
The effect of changing the LTI system on the input is making a HPF instead of LPF as before.
Amplitude
Amplitude
Amplitude
Amplitude
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.
4
o With f1 0.05; f2 0.47; M 15 we obtain:
Amplitude
Amplitude
Amplitude
Amplitude
From this plots we make the following observation that: The high frequency s2 signal is still
removed in the filter output. The low frequency signal s1 is passed but is attenuated in
amplitude.
5
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
From this plots we make the following observation that: Now, both signals s1 and s2 are
high frequency signals so they are removed in the filter output.
Amplitude
Amplitude
Amplitude
From this plots we make the following observation that: Now, both signals s1 and s2 are
low frequency signals so they are passed in the filter output.
6
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:
7
The output signal generated by running this program is plotted below.
Amplitude
Amplitude
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:
o Observing the input and output signals of the system we see that the low-frequency
parts of the left signal are passed to the filter output, and the high-frequency parts of
the signal are subsequently removed from the output. The frequency increases as n
increases, resulting in the signal being attenuated along the increasing of n.
n
'
o From arg an 2 bn an 2 bn 2an b 2. .n f . In
200 2 200
Q2.1 we have the frequency of 0.05 at n 10 .That’s why the signal 1 is passed in the
filter output. Likewise, the frequency of signal 2 is 0.47 at n 94 , that’s why the
signal 2 is attenuated in the filter output.
o The filter in Q2.2 is opposite to Q2.1 when it’s HPF. That’s why the signal s1 with low
frequency is removed in the output where as the signal s2 is passed.
8
Project 2.2 (Optional) A Simple Nonlinear Discrete-Time System
% Program P2_2
% Generate a sinusoidal input signal
clc; clear all; close all;
n = 0:200;
x = cos(2*pi*0.05*n);
% Compute the output signal
x1 = [x 0 0]; % x1[n] = x[n+1]
x2 = [0 x 0]; % x2[n] = x[n]
x3 = [0 0 x]; % x3[n] = x[n-1]
y = x2.*x2-x1.*x3;
y = y(2:202);
% Plot the input and output signals
subplot(2,1,1)
plot(n, x)
xlabel('Time index n');ylabel('Amplitude');
title('Input Signal')
subplot(2,1,2)
plot(n,y)
xlabel('Time index n');ylabel('Amplitude');
title('Output signal');
Q2.5 The sinusoidal signals with the following frequencies as the input signals were used to generate
the output signals: f 0.01; f 0.15; f 0.25
The output signals generated for each of the above input signals are displayed below:
9
o With f 0.01 , we obtain:
Amplitude
Amplitude
Input Signal
1
0.5
-0.5
-1
0 20 40 60 80 100 120 140 160 180 200
Time index n
Output signal
1
0.9
0.8
0.7
0.6
0 20 40 60 80 100 120 140 160 180 200
Time index n
10
o With f 0.25 , we obtain:
Amplitude
Amplitude
The output signals depend on the frequencies of the input signal according to the following
rules: y n cos2 2 fn cos 2 f n 1 . cos 2 f n 1
This observation can be explained mathematically as follows: By expand the above equation,
we can get a conclusion about these previous results.
Q2.6 The output signal generated by using sinusoidal signals of the form x n sin 0n K as
the input signal is shown below for the following values of 0 and K :
11
Amplitude
Amplitude
The dependence of the output signal yt[n] on the DC value K can be explained as the same
way in Q2.5.
12
Project 2.3 Linear and Nonlinear Systems
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:
13
Amplitude
Amplitude
Amplitude
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:
o a 1; b 2; f1 0.02; f2 0.2
o a 1; b 2; f1 0.15; f2 0.25
o a 2; b 8; f1 0.2; f2 0.3
The plots generated for each of the above three cases are shown below:
o With a 1; b 2; f1 0.02; f2 0.2
14
Amplitude
Amplitude
Amplitude
-50
0 5 10 15 20 25 30 35 40
Weighted Output: a y [n] + b y [n]
1 2
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
-1
0 5 10 15 20 25 30 35 40
Time index n
15
Amplitude
Amplitude
Amplitude
Based on these plots we can conclude that the system with different weights is Linear.
Q2.9 Program 2_3 was run with the following non-zero initial conditions - ic = [1 10];
16
The plots generated are shown below:
Amplitude
Amplitude
Amplitude
Based on these plots we can conclude that the system with nonzero initial conditions is Non
Linear.
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:
o a 1; b 2; f1 0.02; f2 0.2
o a 1; b 2; f1 0.15; f2 0.25
o a 2; b 8; f1 0.2; f2 0.3
The plots generated for each of the above three cases are shown below:
17
o With a 1; b 2; f1 0.02; f2 0.2
-50
0 5 10 15 20 25 30 35 40
Weighted Output: a y [n] + b y [n]
1 2
50
-50
0 5 10 15 20 25 30 35 40
Difference Signal
50
-50
0 5 10 15 20 25 30 35 40
Time index n
-50
0 5 10 15 20 25 30 35 40
Weighted Output: a y 1 [n] + b y 2 [n]
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Difference Signal
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Time index n
18
o With a 2; b 8; f1 0.2; f2 0.3
-50
0 5 10 15 20 25 30 35 40
Weighted Output: a y [n] + b y [n]
1 2
200
Amplitude
-200
0 5 10 15 20 25 30 35 40
Difference Signal
200
Amplitude
-200
0 5 10 15 20 25 30 35 40
Time index n
Based on these plots we can conclude that the system with nonzero initial conditions and
different weights is Non Linear.
The output sequences y1[n], y2[n],and y[n] of the above system generated by running the
modified program are shown below:
% Program P2_3
% Generate the input sequences
% clf;
clc;
clear all;
close all;
n = 0:40;
a = 2;b = -3;
x1 = cos(2*pi*0.1*n);
x11=[0 x1]; %x1(n-1)
x12=[x1 0]; %x1(n)
19
y1=x11.*x12;
x2 = cos(2*pi*0.4*n);
x21=[0 x2]; %x2(n-1)
x22=[x2 0]; %x2(n)
y2=x21.*x22;
x = a*x1 + b*x2;
xx1=[0 x];
xx2=[x 0];
y=xx1.*xx2;
yt = a*y1 + b*y2;
d = y - yt; % Compute the difference output d[n]
% Plot the outputs and the difference signal
subplot(3,1,1)
stem([n,41],y);
ylabel('Amplitude');
title('Output Due to Weighted Input: a \cdot x_{1}[n] + b \cdot
x_{2}[n]');
subplot(3,1,2)
stem([n,41],yt);
ylabel('Amplitude');
title('Weighted Output: a \cdot y_{1}[n] + b \cdot y_{2}[n]');
subplot(3,1,3)
stem([n,41],d);
xlabel('Time index n');ylabel('Amplitude');
title('Difference Signal');
Comparing y[n] with yt[n] we conclude that the two sequences are different.
20
Project 2.4 Time-invariant and Time-varying Systems
% Program P2_4
% Generate the input sequences
clc; clear all; close all;
n = 0:40; D = 10;a = 3.0;b = -2;
x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);
xd = [zeros(1,D) x];
num = [2.2403 2.4908 2.2403];
den = [1 -0.4 0.75];
ic = [0 0]; % Set initial conditions
% Compute the output y[n]
y = filter(num,den,x,ic);
% Compute the output yd[n]
yd = filter(num,den,xd,ic);
% Compute the difference output d[n]
d = y - yd(1+D:41+D);
% Plot the outputs
subplot(3,1,1)
stem(n,y);
ylabel('Amplitude');
title('Output y[n]'); grid;
subplot(3,1,2)
stem(n,yd(1:41));
ylabel('Amplitude');
title(['Output due to Delayed Input x[n Ð',
num2str(D),']']); grid;
subplot(3,1,3)
stem(n,d);
xlabel('Time index n'); ylabel('Amplitude');
title('Difference Signal'); grid;
21
Q2.12 The output sequences y[n] and yd[n-10] generated by running Program P2_4 are shown below
Output y[n]
50
Amplitude
0
-50
0 5 10 15 20 25 30 35 40
Output due to Delayed Input x[n Ð10]
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Difference Signal
1
Amplitude
-1
0 5 10 15 20 25 30 35 40
Time index n
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 - 5,12,15
22
o With D 5
Output y[n]
50
Amplitude
0
-50
0 5 10 15 20 25 30 35 40
Output due to Delayed Input x[n Ð5]
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Difference Signal
1
Amplitude
-1
0 5 10 15 20 25 30 35 40
Time index n
o With D 12
Amplitude
Amplitude
Amplitude
23
o With D 15
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:
o f1 0.05; f2 0.1
o f1 0.1; f2 0.25
o f1 0.3; f2 0.5
24
o With f1 0.05; f2 0.1
Amplitude
Amplitude
Amplitude
Output y[n]
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Output due to Delayed Input x[n Ð10]
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Difference Signal
1
Amplitude
-1
0 5 10 15 20 25 30 35 40
Time index n
25
o With f1 0.3; f2 0.5
Amplitude
Amplitude
Amplitude
26
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 - ic = [2 9];
These two sequences are related as follows: y n and yd n are not the shifted versions each
other.
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:
o f1 0.05; f2 0.1
o f1 0.1; f2 0.25
o f1 0.3; f2 0.5
27
o With f1 0.05; f2 0.1
Amplitude
Amplitude
Amplitude
28
o With f1 0.3; f2 0.5
Output y[n]
20
-20
0 5 10 15 20 25 30 35 40
Output due to Delayed Input x[n Ð10]
10
-10
0 5 10 15 20 25 30 35 40
Difference Signal
10
-10
0 5 10 15 20 25 30 35 40
Time index n
In each case, these two sequences are related as follows - y n and yd n are not the shifted
versions each other.
is given below:
% Generate the input sequences
clc; clear all; close all;
n = 0:40; D = 10;a = 3.0;b = -2;
x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);
xd = [zeros(1,D) x];
nd = 0:length(xd)-1;
% Compute the output y[n]
y = (n .* x) + [0 x(1:40)];
% Compute the output yd[n]
yd = (nd .* xd) + [0 xd(1:length(xd)-1)];
29
% Compute the difference output d[n]
d = y - yd(1+D:41+D);
% Plot the outputs
subplot(3,1,1)
stem(n,y);
ylabel('Amplitude');
grid;
subplot(3,1,2)
stem(n,yd(1:41));
ylabel('Amplitude');
grid;
subplot(3,1,3)
stem(n,d);
xlabel('Time index n'); ylabel('Amplitude');
grid;
The output sequences y[n] and yd[n-10] generated by running modified Program P2_4 are
shown below :
Amplitude
Amplitude
Amplitude
These two sequences are related as follows: y n and yd n are not the shifted versions each
other.
30
Q2.18 (optional) The modified Program P2_3 to test the linearity of the system of Q2.18 is shown
below:
% Program Q2_18
% Modify P2_3 for Q2.18.
% Generate the input sequences
clc; clear all; close all;
n = 0:40;
a = 2;b = -3;
x1 = cos(2*pi*0.1*n);
x2 = cos(2*pi*0.4*n);
x = a*x1 + b*x2;
y1 = (n .* x1) + [0 x1(1:40)]; % Compute the output y1[n]
y2 = (n .* x2) + [0 x2(1:40)]; % Compute the output y2[n]
y = (n .* x) + [0 x(1:40)]; % Compute the output y[n]
yt = a*y1 + b*y2;
d = y - yt; % Compute the difference output d[n]
% Plot the outputs and the difference signal
subplot(3,1,1)
stem(n,y);
ylabel('Amplitude');
subplot(3,1,2)
stem(n,yt);
ylabel('Amplitude');
subplot(3,1,3)
stem(n,d);
xlabel('Time index n');ylabel('Amplitude');
31
The outputs y[n]and yt[n] obtained by running the modified program P2_3 are shown below:
Amplitude
Amplitude
Amplitude
Impulse Response
4
2
Amplitude
-1
-2
-3
0 5 10 15 20 25 30 35 40
Time index n
Q2.20 The required modifications to Program P2_5 to generate the impulse response of the following
causal LTI system:
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
Amplitude
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:
% Program Q2_21
% Compute the impulse response y
clc; clear all; close all;
N = 40;
num = [0.9 -0.45 0.35 0.002];
den = [1.0 0.71 -0.46 -0.62];
% input: unit pulse
x = [1 zeros(1,N-1)];
y = filter(num,den,x);
stem(y);
xlabel('Time index n'); ylabel('Amplitude');
title('Impulse Response'); grid;
34
The first 40 samples of the impulse response generated by this program are shown below:
Impulse Response
2
1.5
1
Amplitude
0.5
-0.5
-1
-1.5
0 5 10 15 20 25 30 35 40 45
Time index n
Comparing the above response with that obtained in Question Q2.20 we conclude that they
are similar.
Q2.22 The MATLAB program to generate and plot the step response of a causal LTI system is
indicated below:
% Program Q2_21
% Compute the impulse response
clc; clear all; close all;
N = 40;
num = [0.9 -0.45 0.35 0.002];
den = [1.0 0.71 -0.46 -0.62];
% input: unit pulse
x = [1 zeros(1,N-1)];
y = filter(num,den,x);
stem(y);
xlabel('Time index n'); ylabel('Amplitude');
title('Impulse Response'); grid;
35
The first 40 samples of the step response of the LTI system of Project 2.3 are shown below:
Step Response
8
5
Amplitude
0
0 5 10 15 20 25 30 35 40
Time index n
% Program P2_6
% Cascade Realization
clc; clear all; close all;
x = [1 zeros(1,40)]; % Generate the input
n = 0:40;
% Coefficients of 4th order system
den = [1 1.6 2.28 1.325 0.68];
num = [0.06 -0.19 0.27 -0.26 0.12];
% Compute the output of 4th order system
y = filter(num,den,x);
% Coefficients of the two 2nd order systems
num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8];
num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];
36
% Output y1[n] of the first stage in the cascade
y1 = filter(num1,den1,x);
% Output y2[n] of the second stage in the cascade
y2 = filter(num2,den2,y1);
% Difference between y[n] and y2[n]
d = y - y2;
% Plot output and difference signals
subplot(3,1,1);
stem(n,y);
ylabel('Amplitude');
title('Output of 4th order Realization'); grid;
subplot(3,1,2);
stem(n,y2)
ylabel('Amplitude');
title('Output of Cascade Realization'); grid;
subplot(3,1,3);
stem(n,d)
xlabel('Time index n');ylabel('Amplitude');
title('Difference Signal'); grid;
37
Q2.23 The output sequences y[n], y2[n], and the difference signal d[n] generated by running Program
P2_6 are indicated below:
Q2.24 The sequences generated by running Program P2_6 with the input changed to a sinusoidal
sequence are as follows:
Amplitude
Amplitude
Amplitude
The relation between y[n] and y2[n] in this case is almost similar.
38
Q2.25 The sequences generated by running Program P2_6 with non-zero initial condition vectors are
now as given below:
% Cascade Realization
clc; clear all; close all;
x = [1 zeros(1,40)]; % Generate the input
n = 0:40;
ic=[1 2 3 4];
ic1=[1 2];
ic2=[3 4];
% Coefficients of 4th order system
den = [1 1.6 2.28 1.325 0.68];
num = [0.06 -0.19 0.27 -0.26 0.12];
% Compute the output of 4th order system
y = filter(num,den,x,ic);
% Coefficients of the two 2nd order systems
num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8];
num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];
% Output y1[n] of the first stage in the cascade
y1 = filter(num1,den1,x,ic1);
% Output y2[n] of the second stage in the cascade
y2 = filter(num2,den2,y1,ic2);
% Difference between y[n] and y2[n]
d = y - y2;
% Plot output and difference signals
subplot(3,1,1);
stem(n,y);
ylabel('Amplitude');
title('Output of 4th order Realization'); grid;
subplot(3,1,2);
stem(n,y2)
ylabel('Amplitude');
title('Output of Cascade Realization'); grid;
subplot(3,1,3);
stem(n,d)
xlabel('Time index n');ylabel('Amplitude');
title('Difference Signal'); grid;
39
The relation between y[n] and y2[n] in this case is different.
Q2.26 The modified Program P2_6 with the two 2nd-order systems in reverse order and with zero
initial conditions is displayed below:
% Cascade Realization
clc; clear all; close all;
x = [1 zeros(1,40)]; % Generate the input
n = 0:40;
% Coefficients of 4th order system
den = [1 1.6 2.28 1.325 0.68];
num = [0.06 -0.19 0.27 -0.26 0.12];
% Compute the output of 4th order system
y = filter(num,den,x);
% Coefficients of the two 2nd order systems
num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8];
num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];
% Output y1[n] of the first stage in the cascade
y1 = filter(num2,den2,x);
% Output y2[n] of the second stage in the cascade
y2 = filter(num1,den1,y1);
% Difference between y[n] and y2[n]
d = y - y2;
% Plot output and difference signals
40
subplot(3,1,1);
stem(n,y);
ylabel('Amplitude');
title('Output of 4th order Realization'); grid;
subplot(3,1,2);
stem(n,y2)
ylabel('Amplitude');
title('Output of Cascade Realization'); grid;
subplot(3,1,3);
stem(n,d)
xlabel('Time index n');ylabel('Amplitude');
title('Difference Signal'); grid;
The sequences generated by running the modified program are sketched below:
-1
0 5 10 15 20 25 30 35 40
Output of Cascade Realization
1
-1
0 5 10 15 20 25 30 35 40
-15 Difference Signal
10
5
-5
0 5 10 15 20 25 30 35 40
Time index n
The relation between y[n] and y2[n] in this case is almost similar.
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:
41
The relation between y[n] and y2[n] in this case is different.
Project 2.7 Convolution
42
Q2.28 The sequences y[n] and y1[n] generated by running Program P2_7 are shown below:
Amplitude
Amplitude
The difference between y[n] and y1[n] is that: they are similar.
The reason for using x1[n] as the input, obtained by zero-padding x[n], for generating y1[n]
is:
o For two sequences of length N1 and N2, “conv” returns the resulting sequence of length
N1+N2-1. 9 7 1 15
o “Filter” returns the resulting sequence of the same length as the input signal. To have a
resulting sequences of length 15, we have to append 8 zero elements into x (with length of 7).
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:
The sequences y[n] and y1[n] generated by running modified Program P2_7 are shown below:
The difference between y[n] and y1[n] is that: they are similar.
600
Amplitude
400
200
0
0 5 10 15 20 25
Time index n
Output Generated by Filtering
800
600
Amplitude
400
200
0
0 5 10 15 20 25
Time index n
Q2.30 The purpose of the for command is used for loop to repeat specified number of times.
The purpose of the end command is used to terminate block of code, or indicate last array
index.
Q2.31 The purpose of the break command is used to terminate execution of for or while loop.
Q2.32 The discrete-time system of Program P2_8 is - y[n]+1.5y[n-1]+0.9y[n-
2]=x[n]-0.8x[n-1]
45
The impulse response generated by running Program P2_8 is shown below:
1
Amplitude
-1
-2
-3
0 20 40 60 80 100 120 140 160 180 200
Time index n
Q2.33 The modified Program P2_8 to simulate the discrete-time system of Q2.33 is given below:
clc; clear all; close all;
num = [1 -4 3]; den = [1 -1.7 1.0];
N = 200;
h = impz(num,den,N+1);
parsum = 0;
for k = 1:N+1;
parsum = parsum + abs(h(k));
if abs(h(k)) < 10^(-6), break, end
end
% Plot the impulse response
n = 0:N;
46
stem(n,h)
xlabel('Time index n'); ylabel('Amplitude');
% Print the value of abs(h(k))
disp('Value =');disp(abs(h(k)));
The impulse response generated by running the modified Program P2_8 is shown below:
%Program P2_9
% Generate the input sequence
clc; clear all; close all;
n = 0:299;
x1 = cos(2*pi*10*n/256);
x2 = cos(2*pi*100*n/256);
x = x1+x2;
% Compute the output sequences
num1 = [0.5 0.27 0.77];
y1 = filter(num1,1,x); % Output of System #1
den2 = [1 -0.53 0.46];
num2 = [0.45 0.5 0.45];
47
y2 = filter(num2,den2,x); % Output of System #2
% Plot the output sequences
subplot(2,1,1);
plot(n,y1);axis([0 300 -2 2]);
ylabel('Amplitude');
title('Output of System #1'); grid;
subplot(2,1,2);
plot(n,y2);axis([0 300 -2 2]);
xlabel('Time index n'); ylabel('Amplitude');
title('Output of System #2'); grid;
Q2.34 The output sequences generated by this program are shown below:
The filter with better characteristics for the suppression of the high frequency component of
the input signal x[n] is – System #2.
Output of System #1
2
-1
-2
0 50 100 150 200 250 300
Output of System #2
2
-1
-2
0 50 100 150 200 250 300
Time index n
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:
48
clc; clear all; close all;
n = 0:300;
a = pi/600;
b = 0;
arg = a*n.*n + b*n;
x = cos(arg);
% Compute the output sequences
num1 = [0.5 0.27 0.77];
y1 = filter(num1,1,x); % Output of System #1
den2 = [1 -0.53 0.46];
num2 = [0.45 0.5 0.45];
y2 = filter(num2,den2,x); % Output of System #2
% Plot the output sequences
subplot(2,1,1);
plot(n,y1);axis([0 300 -2 2]);
ylabel('Amplitude');
title('Output of System #1'); grid;
subplot(2,1,2);
plot(n,y2);axis([0 300 -2 2]);
xlabel('Time index n'); ylabel('Amplitude');
title('Output of System #2'); grid;
Output of System #1
2
1
Amplitude
-1
-2
0 50 100 150 200 250 300
Output of System #2
2
1
Amplitude
-1
-2
0 50 100 150 200 250 300
Time index n
The filter with better characteristics for the suppression of the high frequency component of
the input signal x[n] is – System #2.
49