You are on page 1of 1

To find the linear convolution of two sequences

July 27, 2012

Input:
l=input('enter the length of sequence-1') k=input('enter the length of sequence-2') for m=1:l x(m)=input('enter the elements of sequence-1'); end for n=1:k h(n)=input('enter the elements of sequence-2'); end for i=1:(l+k-1) y(i)=0; end for u=1:l for v =1:k y(u+v-1)=y(u+v-1)+x(u)*h(v); end end display y

Output:
enter the length of sequence-15 l= 5 enter the length of sequence-23 k= 3 enter the elements of sequence-11 enter the elements of sequence-18 enter the elements of sequence-13 enter the elements of sequence-16 enter the elements of sequence-14 x= 1 8 -3 6 4

enter the elements of sequence-20 enter the elements of sequence-22 enter the elements of sequence-23 h= 0 y= 0 2 19 18 3 26 1 2 3

You might also like