Ask Your Question

plotting inverse laplace transform

asked 2013-09-10 06:21:37 -0500

anonymous user


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...


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,


edit retag flag offensive close merge delete



It will be hard to plot a function like exp(-1000000*x) which appears in the expression for g... you can try to isolate the terms which matter and create a new expression which only involve them.

vdelecroix gravatar imagevdelecroix ( 2013-09-10 09:04:26 -0500 )edit

well, this is not an issue since the x domain is [0:100e-6].

osfe gravatar imageosfe ( 2013-09-10 21:38:54 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-11 00:45:26 -0500

Ok, since you know the domain of definition of your function you can do

sage: plot(g, xmin=0, xmax=10^-6)

But I am not sure if you can believe what you will see...


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-10 06:21:37 -0500

Seen: 556 times

Last updated: Sep 11 '13