Convolution
Convolution
% linear convolution
n1=input('enter the positive range')
n2=input('entet the negative range')
u1=input('enter the sequence')
subplot(3,1,1)
stem(n2:n1,u1)
n3=input('enter the positive range')
n4=input('entet the negative range')
u2=input('enter the sequence')
subplot(3,1,2)
stem(n4:n3,u2)
N=n2+n4:n1+n3;
c1=length(u1)-1
c2=length(u2)-1
u1=[u1,zeros(1,c2)]
u2=[u2,zeros(1,c1)]
u2=transpose(u2)
u1=transpose(u1)
for i=2:length(N)
u1(1,i)=u1(length(u1),i-1)
for j=2:length(N)
u1(j,i)=u1(j-1,i-1)
end;
end;
z=u1*u2
subplot(3,1,3);
stem(N,z)