Montag, 21. Dezember 2009

Python 038: Faltung einer Dreiecksfunktion mit einer Rechteckfunktion

from numpy import *
from pylab import *
#print convolve.__doc__
#a = arange(12)
a = [0,0,0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,0,0,0] #Dreieck
b = [0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0]
h = convolve(a,b,mode=0)
i = convolve(a,b,mode=1)
#j = convolve(a,b,mode=2)
print(h)
print(i)
#print(j)
plot(i)
hold(True)
#plot(j)
grid(True)
show()

Keine Kommentare:

 
eXTReMe Tracker