DIGITAL SIGNAL PROCESSING
PROPERTIES OF
DISCRETE-TIME SYSTEMS IN THE TIME DOMAIN WITH MATLAB
LINEARITY: For a linear discrete-time system,
if y1[n] and y2[n] are
the responses to the input sequences x1[n] and
x2[n], respectively, then for an input
x[n] = αx1[n] + β
x2[n] (1)
the
response is given by
y[n] = αy1[n] + β
y2[n] (2)
The superposition
property of Eq. (2) must hold for any arbitrary constants α and β and
for all possible inputs x1[n] and x2[n].
If Eq. (2) does not hold for at least one set of nonzero values of α and
β, or one set of nonzero input sequences x1[n] and
x2[n], then the system is nonlinear.
TIME-INVARIANT: For a time-invariant
discrete-time system, if y1[n] is the response to an input x1[n],
then the response to an input
x[n] = x1[n − no]
is
simply
y[n] = y1[n − no]
Where no
is any positive or negative integer. The above relation between the input
and output must hold for any arbitrary input sequence and its corresponding
output. If it does not hold for at least one input sequence and its
corresponding output sequence, the system is time-varying.
LTI-SYSTEM: A linear
time-invariant (LTI) discrete-time system satisfies both the linearity and the
time-invariance properties.
LINEAR AND NONLINEAR SYSTEMS
We now
investigate the linearity property of a causal system.
Consider
the system given by
y[n]−0.4 y[n−1]+0.75 y[n−2] = 2.2403 x[n]+2.4908 x[n−1]+2.2403 x[n−2] (3)
MATLAB
Program P1 is used to simulate the system of Eq. (3), to generate three
different input sequences x1[n], x2[n],
and x[n] = a
· x1[n]+b
· x2[n],
and to compute and plot the corresponding output sequences y1[n],
y2[n], and y[n].
% Program
P1
% Generate
the input sequences
clf;
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;
num = [2.2403
2.4908 2.2403];
den = [1 -0.4
0.75];
ic = [0 0]; %
Set zero initial conditions
y1 =
filter(num,den,x1,ic); % Compute the output y1[n]
y2 =
filter(num,den,x2,ic); % Compute the output y2[n]
y =
filter(num,den,x,ic); % 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');
title('Output
Due to Weighted Input: a \cdot+ x_{1}+[n]+ b \cdot+ x_{2}+[n]');
subplot(3,1,2)
stem(n,yt);
ylabel('Amplitude');
title('Weighted
Output: a \cdot+ y_{1}+[n] + b \cdot+y_{2}+[n]');
subplot(3,1,3)
stem(n,d);
xlabel('Time
index n'); ylabel('Amplitude');
title('Difference
Signal');
RESULTS:
QUESTIONS
Q.1: Consider another system described
by:
y[n] = x[n]+x[n − 1].
Modify y1[n],
y2 Program P1 to compute the output sequences [n], and y[n] of the above
system. Compare y[n] with yt[n]. Are these two sequences equal? Is this system linear?
MATLAB CODE:
clf;
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;
num = [1
1];
den =
[1];
ic = [0];
% Set zero initial conditions
y1 =
filter(num,den,x1,ic); % Compute the output y1[n]
y2 =
filter(num,den,x2,ic); % Compute the output y2[n]
y =
filter(num,den,x,ic); % 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');
title('Output Due to Weighted Input: a \cdot+ x_{1}+[n]+ b \cdot+ x_{2}+[n]');
subplot(3,1,2)
stem(n,yt);
ylabel('Amplitude');
title('Weighted Output: a \cdot+ y_{1}+[n] + b \cdot+y_{2}+[n]');
subplot(3,1,3)
stem(n,d);
xlabel('Time index n'); ylabel('Amplitude');
title('Difference Signal');
RESULTS:
Time-Invariant
and Time-Varying Systems
We next
investigate the time-invariance property (of a causal system.
Consider again the system given by Eq. (3).
MATLAB Program P2 is used to simulate the system of Eq. (3), to generate two different
input sequences x[n] and x[n - D], and to compute and plot the corresponding output
sequences y1[n], y2[n], and the difference y1[n]
- y2[n + D].
% Program
P2
% Generate
the input sequences
clf;
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;
RESULT:
Q.3: Consider
another system described by:
y[n] = nx[n] + x[n − 1]
Modify
Program P2 to simulate the above system and determine whether this system is
Time-invariant or not.
clf;
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 = [n
1];
den =
[1];
ic = [n];% 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;
RESULTS: It’s a time variant system.