You are on page 1of 1

Write a program without using conv command and for loop to convolve two

arbitrary length signals. (Hint: Use Toeplitz command).

x = 1:5,y=rand(1,5),
Answer
x =

1 2 3 4 5
y =

0.1576 0.9706 0.9572 0.4854 0.8003

c1=(tril(toeplitz(x))*y(:)).'
answer

c1 =

0.1576 1.2858 3.3712 5.9419 9.3130

c2=conv(x,y);c2=c2(1:numel(c1))

Answer
c2 =

0.1576 1.2858 3.3712 5.9419 9.3130

You might also like