You are on page 1of 1

Convolucion

1. #By Mark Wickert from Signals and Systems For Dummies


2. import numpy as np
3. import pylab as pl
4. import ssd
5.
6. n=np.arange(-4,6)
7. xd1=2*ssd.drect(n,4)
8. hd1=1.5*ssd.dimpulse(n)-0.5*ssd.drect(n+1,3)
9. #hd1=-0.5*ssd.dimpulse(n+1)+1*ssd.dimpulse(n)-
0.5*ssd.dimpulse(n-1)
10. yd1_num,nd1=ssd.conv_sum(xd1,n,hd1,n)
11. #pl.subplot(1,3,1)
12. pl.figure(1)
13. pl.stem(n,xd1)
14. pl.title('x[n]'), pl.axis([-4,5,-1,3]),pl.grid(True)
15. #pl.subplot(1,3,2)
16. pl.figure(2)
17. pl.stem(n,hd1),pl.grid(True)
18. pl.title('h[n]')
19. #pl.subplot(1,3,3)
20. pl.figure(3)
21. pl.stem(nd1,yd1_num), pl.axis([-4,5,-
2,2]),pl.grid(True)
22. pl.title('y[n]=x[n]*h[n]')

You might also like