Ask Your Question
0

plotting inverse laplace transform

asked 2013-09-10 13:21:37 +0200

anonymous user

Anonymous

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

edit retag flag offensive close merge delete

Comments

1

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 16:04:26 +0200 )edit

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

osfe gravatar imageosfe ( 2013-09-11 04:38:54 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-11 07:45:26 +0200

vdelecroix gravatar image

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

Vincent

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

Stats

Asked: 2013-09-10 13:21:37 +0200

Seen: 1,256 times

Last updated: Sep 11 '13