0% found this document useful (0 votes)
27 views12 pages

LTI System Response Analysis in MATLAB

Uploaded by

darshansrathod12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views12 pages

LTI System Response Analysis in MATLAB

Uploaded by

darshansrathod12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Signal Processing Lab

Experiment-2
Response of LTI system

Name: A R Santhosh Kumar


USN: 1MS22EC002

Date of Exp: 3/05/2024

1. Given the difference equation y(n)-y(n-1)+0.9y(n-


2)=x(n), plot the
(i) impulse response (ii) step response and (iii)
response with the input x(n)=(1/4)^n.u(n)
Code:

clc;clear;close;

b=1;

a=[1 -1 0.9];

n=0:50;

delta=(n==0);

h=filter(b,a,delta);

figure(1)

subplot(211);stem(n,delta); title('Impulse Input');

subplot(212);stem(n,h); title('Impulse Response');

step=(n>=5);

s=filter(b,a,step);

figure(2)

subplot(211);stem(n,step); title('Step Input');


1|Page
subplot(212);stem(n,s); title('Step Response');

x=0.25.^n;

y=filter(b,a,x);

figure(3)

subplot(211);stem(n,x); title('Real Exponential Input');

subplot(212);stem(n,y); title('Output Response');

Output

2|Page
Inference: The MatLab code to plot the impulse response, step
response and response was executed and the graph was plotted

Assignment 1: Plot the impulse response, step response


and the output of the system y(n)-0.9y(n-1)=x(n) for the
input x(n)=u(n)-u(n-10).

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)

subplot(211);stem(n,delta); title('Impulse Input');

subplot(212);stem(n,h); title('Impulse Response');

step=(n>=5);

s=filter(b,a,step);

figure(2)

subplot(211);stem(n,step); title('Step Input');

subplot(212);stem(n,s); title('Step Response');

x=0.25.^n;

y=filter(b,a,x);

figure(3)

subplot(211);stem(n,x); title('Real Exponential Input');

subplot(212);stem(n,y); title('Output Response');

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)

subplot(211);stem(n,delta); title('Impulse Input');

subplot(212);stem(n,h); title('Impulse Response');

step=(n>=5);

s=filter(b,a,step);

figure(2)

subplot(211);stem(n,step); title('Step Input');

subplot(212);stem(n,s); title('Step Response');

x=0.25.^n;

y=filter(b,a,x);

figure(3)

subplot(211);stem(n,x); title('Real Exponential Input');

6|Page
subplot(212);stem(n,y); title('Output Response');

Output

7|Page
[Link] output of LTI system with arbitrary inputs
using convolution sum for discrete time systems
Code:

clc;clear;close;

x=input("Enter the first sequence x=");

nx=input("Enter the index of the first sequence nx=");

h=input("Ente the second sequence(impulse response of the


system) h=");

nh=input("Enter the index of the second sequence nh=");

n=min(nx)+min(nh):max(nx) + max(nh);

y=conv(x,h);

8|Page
disp('The convolved sequence is:');y

disp('The index of convolved sequence is: ');n

subplot(311);

stem(nx,x);

subplot(312);

stem(nh,h);

subplot(313);

stem(n,y);

Assignment 1: Determine the response of a LTI system


with impulse response h(n)={1,2,1,-1} to the input
x(n)={1,2,3,1}. Plot the output response.
Command window:

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

You might also like