Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

plotting inverse laplace transform

Hi there, I'm studying a 4th order (two second order filters cascaded) electronic filter and I need it's time response. I have derivated the transfert function and to get the time response, I apply the inverse laplace transform of the transfer function multiplied by a ramp. Sage returns a result and I would like to plot this result, in order to check if this is correct but I don't know how to do so...

#!/opt/sage-5.11/sage 

import cmath as m

from sage.calculus.calculus import inverse_laplace

r11 = 200.00e3
r21 = 800.00e3
c11 = lambda n: 1.25e-12 * (n+1)
c21 = lambda n: 312.5e-15 * (n+1)
wz1 = lambda n: 1/(r21*c11(n))
wp1 = lambda n: 1/(r11*c11(n))

# second filter
r12 = 266.67e3
r22 = 200.00e3
r32 = 800.00e3
c12 = lambda n: 1.25e-12*(n+1)
c22 = lambda n: 312.5e-15*(n+1)
A = r32/r12
w02 = lambda n: abs(1/(m.sqrt(r22*r32*c12(n)*c22(n))))
w02sq = lambda n: 1/(r22*r32*c12(n)*c22(n))

# second order coefficient
a = lambda n: 1/w02sq(n)
b = lambda n: r22*r32*c22(n)*((1/r12) + (1/r22) + (1/r32))



# gain
k = lambda n: A/wz1(n)

# input pulse
gain = 4

# electron injection
injfc = lambda x: x*1.602177e-19

# input 
ampout = lambda x: injfc(x)/50e-15

# some more gain
gainout = lambda x: ampout(x)*gain

# set a value for i
i = 3

# declare p as a variable
p = var('p')

# the transfer function
f = ((k(i)*p) / (((1+p/wp1(i))**2) * ((p/w02(i))**2 + b(i)*p + 1)))

# transfer function multiplied by a very fast ramp and the input
fs = f*(2.00e6/p**2)*gainout(25000)

# please, gimme the inverse laplace
g = fs.inverse_laplace(p,x)
print "g(x) = ", g

# this is where I would like to plot g
# plot (g(x))

Thank you very much for your help

Best regards,

Olivier