4
$\begingroup$

I am attempting to use Mathematica to model an electrical circuit in the s domain. The circuit contains capacitances and and inductances. I've written a series of equations using Kirchoff's laws to solve for various currents in the circuit; however, this output is in the s domain. I would like to transform the output back into the time domain. The outputs that I obtain using ExpToTrig[InverseLaplaceTransform[expr,s,t]] are large and complicated. They contain several complex sin and hyperbolic sin terms. I know, from my knowledge of the circuit that the time domain solution should consist of three or four exponentially decaying terms and a single steady state sinusoid. How can I convert this complicated output into one that consists of a few decaying exponentials and a single, phase shifted sinusoid?

The s domain expression for ig that I want to transform into the time domain is:

ig=(3.25269*10^7 s)/((424000. + 923. s) (142122. + s^2))

Below, I have copied some of the code that I've tried.

In[168]:= ig = (
 3.2526911934581187`*^7 s)/((424000.` + 
    923.` s) (142122.30337568675` + s^2))

Out[168]= (3.25269*10^7 s)/((424000. + 923. s) (142122. + s^2))

In[169]:= ExpToTrig[InverseLaplaceTransform[ig, s, t]]

Out[169]= 
3.25269*10^7 (-1.40932*10^-6 Cosh[
     459.372 t] + (Cos[(376.991 + 0. I) t] - 
      I Sin[(376.991 + 0. I) t]) ((7.0466*10^-7 + 
        5.78292*10^-7 I) + (7.0466*10^-7 - 
         5.78292*10^-7 I) Cos[(753.982 + 0. I) t] + (5.78292*10^-7 + 
         7.0466*10^-7 I) Sin[(753.982 + 0. I) t]) + 
   1.40932*10^-6 Sinh[459.372 t])

In[170]:= Simplify[%]

Out[170]= 
3.25269*10^7 (-1.40932*10^-6 Cosh[
     459.372 t] + (Cos[(376.991 + 0. I) t] - 
      I Sin[(376.991 + 0. I) t]) ((7.0466*10^-7 + 
        5.78292*10^-7 I) + (7.0466*10^-7 - 
         5.78292*10^-7 I) Cos[(753.982 + 0. I) t] + (5.78292*10^-7 + 
         7.0466*10^-7 I) Sin[(753.982 + 0. I) t]) + 
   1.40932*10^-6 Sinh[459.372 t])

In[171]:= FullSimplify[%]

Out[171]= 0. - 
 45.8409 E^(-459.372 t) + (22.9204 + 18.81 I) E^((0. - 376.991 I) t) +
  (22.9204 - 18.81 I) E^((0. + 376.991 I) t)

In[172]:= ExpToTrig[%]

Out[172]= 0. + (45.8409 + 0. I) Cos[(376.991 + 0. I) t] - 
 45.8409 Cosh[459.372 t] + (37.6201 + 0. I) Sin[(376.991 + 0. I) t] + 
 45.8409 Sinh[459.372 t]
$\endgroup$
3
  • 2
    $\begingroup$ Your question will be so much better if you supply actual working code to reproduce your problem. $\endgroup$ – Yves Klett Dec 11 '13 at 8:26
  • 1
    $\begingroup$ May we assume that Simplify, FullSimplify and other algebraics transforming functions didn't help? $\endgroup$ – Sjoerd C. de Vries Dec 11 '13 at 8:57
  • $\begingroup$ @SjoerdC.deVries Probably Simplify and FullSimplif give combinations of hyperbolic sine and cosine functions, and OP would prefere to have the result in the form of exponentials. $\endgroup$ – au700 Dec 11 '13 at 9:34
4
$\begingroup$

For clarity, I would write the expression as a symbolic expression and a bunch of numerical replacement rules. So

igSymbolic = (a s)/((b + c s) (d + e s^2))

and

replRules={a -> 3.25269*10^7, b -> 424000., c -> 923., d -> 142122., e -> 1}.

You don't need ExpToTrig here, the inverse Laplace transform of your expression is a decaying exponential and a couple of trigonometric functions (you can see that by taking your expression apart and looking up an inverse Laplace transform table). Anyway, you may take the inverse Laplace transform of the symbolic expression and simplify:

InverseLaplaceTransform[igSymbolic, s, t] // FullSimplify

(*out*)(a (-b E^(-((b t)/c)) + b Cos[(Sqrt[d] t)/Sqrt[e]] + (
   c Sqrt[d] Sin[(Sqrt[d] t)/Sqrt[e]])/Sqrt[e]))/(c^2 d + b^2 e)

and use the replacement rules at the very end:

% /.replRules

(*out*)0.000108115 (-424000. E^(-459.372 t) + 424000. Cos[376.991 t] + 
   347962. Sin[376.991 t])

to get a decaying exponential and a couple of trigonometric functions.

$\endgroup$
2
  • $\begingroup$ Wow, Thank you so much. That is the exact form of the expression that I wanted. I'm still curious though, is it possible to use Mathematica's functions to convert the form of the expression that used the hyperbolic trig functions into this form? $\endgroup$ – CrawdadMan Dec 11 '13 at 10:30
  • $\begingroup$ Yes, there definitely should be. You need to tell Simplify to assume that the the hyperbolic functions are less complicated as exponentials and the trigonometric functions are fine the way they are. A pattern wizard might be better at addressing this than I am. An appropriately defined ComplexityFunction would be the starting point (see the discussion here) $\endgroup$ – gpap Dec 11 '13 at 11:03
1
$\begingroup$

This is your code for InverseLaplaceTransform.

ig = (3.2526911934581187`*^7 s)/((424000.` + 923.` s) (142122.30337568675` + s^2))

I have tried using ComplexExpand .

InverseLaplaceTransform[ig, s, t] // Simplify // ComplexExpand // FullSimplify

or

InverseLaplaceTransform[ig, s, t] // Simplify // ComplexExpand // Simplify // Chop

-45.8409 E^(-459.372 t) + 45.8409 Cos[376.991 t] + 37.6201 Sin[376.991 t]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.