DSP Lab3
DSP Lab3
EXPERIMENT NO 03
Objective: Familiarizing students with Linear Time Invariant systems verifying its properties
LAB ASSESSMENT:
Attributes Excellent Good Average Satisfactory Unsatisfactory
(5) (4) (3) (2) (1)
Data presentation
Experimental results
Conclusion
Date: Signature:
1|Page
LABORATORY
EXPERIMENT NO. 3
Objectives:
• Familiarizing students with Linear Time Invariant systems verifying its properties
Equipment required:
Background Knowledge:
A system is a mathematical model, a piece of code, a physical device, or a black box which takes an
input, processes it, and generates an output. A system is a defined by the type of input and output it
deals with. A discrete time system has inputs and outputs that are discrete time signals, and a
continuous time system has inputs and outputs that are continuous time signals.
Let D[·] denote a discrete time system that has discrete time input x[n] and discrete time output y[n].
Then we denote this input/output relationship as
y[n] = D [x[n]]
where we emphasize that D[·] operates on the entire input signal x[n] to produce the output signal
y[n].
Let C[·] denote a continuous time system that has continuous time input x(t) and continuous time
output y(t). Then we denote this input/output relationship as
y(t) = T [x(t)].
Generally, systems are characterized into following categories:
2|Page
ii. Time variant and time invariant systems
iii. Static and dynamic systems
iv. Causal and non-causal systems
v. Invertible and non-invertible systems vi. Stable and unstable systems
Linear and Non-Linear Systems:
A system is known as a linear system if it obeys the principle of homogeneity and superposition.
Principle of Homogeneity:
If an input x is passed through the linear system L and results in output y, then according to principle
of homogeneity, if x is scaled by a value α and is passed through the same system L, the output will
also be scaled by α.
Superposition Principle:
According to the principle of superposition, if two inputs are added together and passed through a
linear system, the output will be the sum of the individual inputs' outputs. For instance, a system
which gives an output 𝑦1 for an input 𝑥1 and an output 𝑦2 for an input 𝑥2, must produce an output [𝑦1
+ 𝑦2] for an input [𝑥1 + 𝑥2].
The principle of homogeneity mentioned above holds in conjunction with the superposition principle.
Therefore, if the inputs x1 and x2 are scaled by factors 𝑎1 and 𝑎2, respectively, then the sum of these
scaled inputs will give the sum of the individual scaled outputs.
A continuous-time system is said to be linear if it satisfies the principle of superposition, such as:
Similarly, a discrete-time system is said to be linear if it satisfies the principle of superposition, such
as:
Therefore, a system is called linear system if the output of the system due to weighted sum of inputs
is equal to the weighted sum of outputs.
If x[n] is an input signal and y[n] is output signal, then:
𝑦[𝑛] = 𝐿(𝑥[𝑛])
𝑦3[𝑛] = 𝐿[ 𝑥3[𝑛] ]
3|Page
𝐿[𝑎1𝑥1[𝑛] + 𝑎2𝑥2[𝑛]] = 𝑎1𝑦1[𝑛] + 𝑎2𝑦2[𝑛]
When x(t) and x(t−t0) are passed through a time-invariant system, the inputs x(t) and x(t−t0) produce
the same output. The only difference is that the output due to x(t−t0) is shifted by a time t0.
If a system is both linear and time invariant, then that system is called Linear and Time Invariant
(LTI) system.
Linear Time Invariant System:
Impulse response is used to characterize an LTI system and is called the system’s impulse response.
The impulse response h[n] of an LTI system is the response to an impulse. The significance of h[n] is
that we can compute the response to any input once we know the response of LTI system to an
impulse signal.
Properties of Linear Time Invariant System:
Convolution of LTI systems follows commutative, associative, and distributive law.
Commutative property:
𝑥(𝑡) ∗ ℎ(𝑡) = ℎ(𝑡) ∗ 𝑥(𝑡)
Associative property:
𝑥(𝑡) ∗ {ℎ1(𝑡) ∗ ℎ2(𝑡)} = {𝑥(𝑡) ∗ ℎ1(𝑡)} ∗ ℎ2(𝑡)
Distributive property:
1. Causality:
A causal system does not produce an output before an input is applied. Therefore, the
output of a causal system depends only on the present and past values of input but not on
the future inputs. Hence, for a causal LTI system: ℎ(𝑡) = 0, 𝑓𝑜𝑟 𝑡 < 0
4|Page
The output of a causal LTI system for a causal input is given by:
2. Stability:
If for a given system every bounded input produces a bounded output, then the system is
stable. The stability of an LTI system can be determined from its impulse response. For a
continuous-time LTI system to be stable, its impulse response h(t) must be absolutely
integrable, i.e.
3. Memory:
An LTI system is called static or memoryless system if its output at any time depends only
upon the value of the input at that time.
5|Page
Lab Tasks:
1. Suppose that an LTI system is described by impulse response ℎ[𝑛] = 𝑒2𝑛.𝑢[−𝑛]. Compute
response of the system to the input signal 𝑥1[𝑛] = 𝑢[𝑛 + 3] and 𝑥2[𝑛] = 𝑢[𝑛 − 1]; where 𝑢[𝑛]
exists between − 5: 5.
Hint: (𝑢[𝑛] is the unit step function. Use the ‘conv’ function for computing the convolution of
the given signals and use subplot() command to plot 𝑥[𝑛],ℎ[𝑛] and 𝑦[𝑛].
CODE:
n=-5:5;
for i=1:length(n)
if(n(i)<0)
u(i)=1;
else
u(i)=0;
end
end
h=exp(2*n).*u;
for i=1:length(n)
if(n(i)<-3)
u1(i)=0;
else
u1(i)=1;
end
end
for i=1:length(n)
if(n(i)<0)
u2(i)=1;
else
u2(i)=0;
end
end
x1=u1;
x2=u2;
y1=conv(x1,h)
y2=conv(x2,h)
ny1=(min(n)+min(n)):(max(n)+max(n));
subplot(3,2,1)
stem(n,x1,'red')
title('x1[n]')
axis([-6 6 0 1])
subplot(3,2,2)
stem(n,x2,'red')
6|Page
title('x2[n]')
axis([-6 6 0 1])
subplot(3,2,3:4)
stem(n,h,'blue')
title('h[n]')
axis([-6 6 0 0.45])
subplot(3,2,5)
stem(ny1,y1,'Black')
title('y1[n]')
subplot(3,2,6)
stem(ny1,y2,'green')
title('y2[n]')
OUTPUT:
7|Page
2. Consider the given signals:
𝑥[𝑛] = cos(𝑛) . 𝑢[𝑛]
ℎ1[𝑛] = 𝑒−𝑛.𝑢[−𝑛 + 5]
ℎ2[𝑛] = (0.2)𝑛.𝑢[𝑛 − 1]
where, 𝑛 = −5:5. Verify distributive property of convolution of LTI systems for the given
signals. Use subplot command to plot these signals, LHS and RHS results of the property.
CODE:
n=-5:5;
for i=1:length(n)
if(n(i)<0)
u(i)=0;
else
u(i)=1;
end
end
x=cos(n).*u;
for i=1:length(n)
if(n(i)<=-5)
u1(i)=1;
else
u1(i)=0;
end
end
h1=exp(-n).*u1;
for i=1:length(n)
if(n(i)<-1)
u2(i)=0;
else
u2(i)=1;
end
end
h2=(0.2).^n.*u2;
h=h1+h2;
LHS=conv(h,x)
y1=conv(x,h1);
y2=conv(x,h2);
RHS=y1+y2
ny1=(min(n)+min(n)):(max(n)+max(n));
subplot(3,2,1)
stem(n,h1,'red','filled')
title('h1[n]')
8|Page
subplot(3,2,2)
stem(n,h2,'Blue','filled')
title('h2[n]')
subplot(3,2,3:4)
stem(n,x,'red','filled')
title('x[n]')
subplot(3,2,5)
stem(ny1,LHS,'red','filled')
title('LHS[n]')
subplot(3,2,6)
stem(ny1,RHS,'Black','filled')
title('RHS[n]')
OUTPUT
9|Page
10 | P a g e
3. Consider the following discrete time system described by I/O relation .
State your assumptions in choosing signal 𝑥1(𝑛) and 𝑥2(𝑛) and respective time ranges. Use
subplot command to plot all the relevant plots and comment on the linearity and time
variance of the system.
Hint: The superposition theorem to prove linearity of a discrete time signal is given by: 𝐿[
𝑎1𝑥1(𝑛) + 𝑎2𝑥2(𝑛) ] = 𝑎1 𝐿[ 𝑥1(𝑛) ] + 𝑎2 𝐿[ 𝑥2(𝑛) ]
CODE
n=-10:10;
a=input('Enter a number for scaling =');
for i=1:length(n)
if(n(i)<0)
u(i)=0;
else
u(i)=1;
end
end
%Homogenity check
x=input('Enter the input for system = ');
h=exp(n).*u;
y=conv(x,h);
mul=a.*x;
yscaled=conv(mul,h);
aa=yscaled/a;
if(y==aa)
disp('Principal of homogenity is satisfied')
else
disp('Not a homogeneos')
end
%Superposition
x1=input('Enter the first input for syperposition= ');
x2=input('Enter the 2nd input dor superposition = ');
y1=conv(x1,h);
y2=conv(x2,h);
y3=conv(x1+x2,h)
if(y3==y1+y2)
disp('The system is superposition system')
else
disp('The system is not superposition system')
end
subplot 331
stem(n,h,'red')
subplot 332
stem(n,x,'red')
subplot 333
stem(n,u,'red')
subplot 334
stem(n,x1,'red')
subplot 335
11 | P a g e
stem(n,x2,'red')
%Check the time inveriance
x11=input('Enter input sequence x11:');
shift=input('Enter shift:');
x22=[zeros(1,shift),x11];
y1=x11;
y2=x22;
y3=[zeros(1,shift),y1];
if(y2==y3)
disp('The system is time invariant');
else
disp('The system is not time variant');
end;
OUTPUT
Conclusion:
In this lab, we have deal with the Linear Time Invariant (LTI) systems and examined their key
properties, including linearity and time invariance, by analyzing system responses through
convolution. First, we investigated a discrete-time system by selecting two input signals,
x1(n)x_1(n)x1(n) and x2(n)x_2(n)x2(n), and applied the superposition theorem to determine if the
system was linear. Using MATLAB, we plotted the results and verified whether the system satisfied
the properties of additivity and homogeneity, which are essential for linearity. Next, we analyzed an
LTI system with a given impulse response h(n)h(n)h(n) and computed its output for two different
input signals. By using the convolution operation (conv function in MATLAB), we determined how
the system processes different inputs and visualized the results through subplots.Through these
experiments, we evaluated the linearity and time invariance of the system. And convolution,
impulse response, and signal transformation.
12 | P a g e