I've got the following transfer function (in the s-domain):


Is there a function in Mathematica 10 that I can go back to the differential equation (in the t-domain), I've looked for it but I'm not be able to find it?

Thanks in advance

  • $\begingroup$ This would benefit from addition of Mathematica code at least for the definition of the function in question. $\endgroup$ – Daniel Lichtblau Nov 29 '15 at 20:13

You can use the definition of Laplace. Assuming zero initial conditions, replace $s$ with $\frac{dy}{dt}$ and $s^2$ with $\frac{d^2y}{dt^2}$ and so on.

tfToDiff[tf_, s_, t_, y_, u_] := Module[{rhs, lhs, n, m},
  rhs = Numerator[tf];
  lhs = Denominator[tf];
  rhs = rhs /. m_. s^n_. -> m D[u[t], {t, n}];
  lhs = lhs /. m_. s^n_. -> m D[y[t], {t, n}];
  lhs == rhs

Now call it

tf = C0 s/(R0 C0 s + 1);
eq=tfToDiff[tf, s, t, y, u]

Mathematica graphics

$y(t)$ is your output, and $u(t)$ is the input. (these are what go in the transfer function when you write $\frac{Y(s)}{U(s)}=\dots$. You'd have to replace this when the actual $u(t)$ to solve the differential equation. For step input, (i.e. $u(t)=\text{unit step}$)

eq = eq /. u'[t] -> UnitStep'[t];
DSolve[{eq, y[0] == 0}, y[t], t]

Mathematica graphics

Another Example

tf = (5 s)/(s^2 + 4 s + 25);
tfToDiff[tf, s, t, y, u]

Mathematica graphics

  • $\begingroup$ Your last Example gives me nothing, how can I make it work? I jsut copied your code $\endgroup$ – Jan Nov 29 '15 at 21:09
  • $\begingroup$ @JanEerland You need to have the function tfToDiff defined first. $\endgroup$ – Nasser Nov 29 '15 at 21:10
  • $\begingroup$ How can I do that? $\endgroup$ – Jan Nov 29 '15 at 21:10
  • $\begingroup$ Yes, of course I got it, thanks a lot! $\endgroup$ – Jan Nov 29 '15 at 21:13

Depending on what you want to do with it, you might use the built-in InverseLaplaceTransform:

InverseLaplaceTransform[c s/(1 + r c s), s, t]

c (-(E^(-(t/(c r)))/(c^2 r^2)) + DiracDelta[t]/(c r))

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.