%%Experiment No.3
%Aim:To study and perform use of convolution tool for LTI Discrete time system Analysis
%Name: Anurag R Kados
%Roll NO.: EC2162
%Batch No.: A-5
%Class: SY-A(E&TC)
%Subject: Signal & System

%Code Two

x=input('Enter First Sequence:')
l1=input('Enter Lower Limit-1:')
u1=input('Enter Upper Limit-1:')
x1=l1:u1
h=input('Enter Second Sequence:')
l2=input('Enter Lower Limit-2:')
u2=input('Enter Upper Limit-2:')
h1=l2:u2
l=l1+l2
u=u1+u2
a=l:u
m=length(x)
n=length(h)
X=[x,zeros(1,n)]
subplot(3,1,1)
stem(x1,x)
H=[h,zeros(1,m)]
subplot(3,1,2)
stem(h1,h)
for i=1:n+m-1
    Y(i)=0
for j=1:m
    if ((i-j+1)>0)
        Y(i)=Y(i)+x(j)*H(i-j+1)
else
end
end
end

subplot(3,1,3)
stem(a,Y)
     

Enter First Sequence:[1,2,3,4,5]

Enter Lower Limit-1:1

Enter Upper Limit-1:5

Enter Second Sequence:[6,7,8,9,10]

Enter Lower Limit-2:6

Enter Upper Limit-2:10