You are on page 1of 1

Convolution:

MFile Code:
function[n,y]=conv_n(x1,n1,x2,n2)
na=min(n1)+min(n2)
nb=max(n1)+max(n2)
n=na:nb
y=conv(x1,x2)
end
Result:
x =3 11 7 0 -1 4 2
h =2 3 0 -5 2 1
nx = -3 -2 -1 0 1 2 3
nh =-1 0 1 2 3 4
na =-4 nb =7
n = -4 -3 -2 -1 0 1 2 3 4 5 6 7
y = 6 31 47 6 -51 -5 41 18 -22 -3 8 2

You might also like