SP 2
SP 2
SP 2
Experiment-2
Response of LTI system
clc;clear;close;
b=1;
a=[1 -1 0.9];
n=0:50;
delta=(n==0);
h=filter(b,a,delta);
figure(1)
step=(n>=5);
s=filter(b,a,step);
figure(2)
x=0.25.^n;
y=filter(b,a,x);
figure(3)
Output
2|Page
Inference: The MatLab code to plot the impulse response, step
response and response was executed and the graph was plotted
3|Page
Code:
clc;clear;close;
b=1;
a=[1 -0.9];
n=0:50;
delta=(n==0);
h=filter(b,a,delta);
figure(1)
step=(n>=5);
s=filter(b,a,step);
figure(2)
x=0.25.^n;
y=filter(b,a,x);
figure(3)
4|Page
Output:
5|Page
Assignment 2: For the above system, assume the initial
conditions as y(-1)=4 and y(-2)=2 and obtain the output
response. (Hint: filtic function)
Code:
clc;clear;close;
b=1;
a=[1 -1 0.9];
n=0:50;
Y=[4 2];
Z=filtic(b,a,Y);
delta=(n==0);
h=filter(b,a,delta);
figure(1)
step=(n>=5);
s=filter(b,a,step);
figure(2)
x=0.25.^n;
y=filter(b,a,x);
figure(3)
6|Page
subplot(212);stem(n,y); title('Output Response');
Output
7|Page
2.Determine output of LTI system with arbitrary inputs
using convolution sum for discrete time systems
Code:
clc;clear;close;
n=min(nx)+min(nh):max(nx) + max(nh);
y=conv(x,h);
8|Page
disp('The convolved sequence is:');y
subplot(311);
stem(nx,x);
subplot(312);
stem(nh,h);
subplot(313);
stem(n,y);
Plot:
9|Page
Assignment 2: Determine the response of a LTI sytem with
impulse response h(n)= an u(n) ,|a|=1 .To the input x(n)=u(n).
Assume n=[0:5].Plot the output response.
Command window:
Plot:
10 | P a g e
Assignment 3: Given x(n)= [3,11,7,0,-1,4,2],-3≤n≤3, h(n)=
[2,3,0,-5,2,1],-1≤n≤4,plot the output of the system.
Command Window:
Plot:
11 | P a g e
12 | P a g e