Convolución continua con Python.

#By Mark Wickert from Signals and Systems For Dummies
def expo_conv(t,A,alpha):
    import numpy as np
    y = np.zeros(len(t))
    for k, tk in enumerate(t):
        if tk >= 0:
            y[k] = A/alpha*(1 - np.exp(-alpha*tk))
    return y

import numpy as np
import pylab as pl
import ssd
    
t = np.arange(-4,14,.01)
xc2 = ssd.step(t)
hc2 = ssd.step(t)*np.exp(-1*t)
yc2_num,tyc2 = ssd.conv_integral(xc2,t,hc2,t,('r','r'))
#pl.subplot(211)
pl.plot(tyc2,yc2_num,linewidth=2)
pl.grid(True)
pl.xlabel('Tiempo (t)')
pl.title('y(t)=x(t)*h(t)')
pl.axis([-8,10,-0.5,1.5])
#pl.subplot(212)
#pl.plot(t,expo_conv(t,1,1))

4 comentarios:

  1. Hola, la puedes bajar de aquí:http://www.eas.uccs.edu/~mwickert/ssd/
    Copias el ssd.py en la misma carpeta de tu programa.

    ResponderBorrar
  2. ¿Cómo se llama la carpeta en la que debe ir el ssd?

    ResponderBorrar

Related Posts Plugin for WordPress, Blogger...