# solving linear ODE with Laplace transformation

I'm trying to solve a linear ODE with Laplace transformation.

Here is my code :

EqDiff = m*D[x[t], {t, 2}] + c*D[x[t], t] + k*x[t] == f[t]
f[t_] := HeavisideTheta[t] - HeavisideTheta[t - \[Tau]]
(EqLaplace = LaplaceTransform[EqDiff, t, s] /. {x[0] -> 0,
SolLapX = Solve[EqLaplace, LaplaceTransform[x[t], t, s]]
SolTemx =  InverseLaplaceTransform[SolLapX[[1, 1, 2]], s, t] /. {m -> 1, c -> 2, k -> 3, \[Tau] -> 1}
x[t_] := SolTemx
Plot[x, {t, 0, 10}]


I didn't obtain a plot with Plot function. I suppose that it is due to the fact that the result from the InversLaplaceTransform function is not simplifier and can be analysed as a complex.

Do you have some ideas so as to simplify the result obtained with the InversLaplaceTransform so that i can obtain the plot.

I tried FullSimplify but it didn't work.

• Try plotting x[t], since that is what you have defined, or Re[x[t]] if necessary – Bill Watts Dec 14 '17 at 8:38
• perfect it works. The only issue is that the plot has some blanks... Some parts of the plot are not plotted, it is like i have some display problems. Do you have an ideas of the cause ? – Bendesarts Dec 14 '17 at 8:59
• but, with the real part the plot is perfect, it may come from numerical approximations – Bendesarts Dec 14 '17 at 9:00
• See my answer. With the ComplexExpand and FullSimplify, you don't even need the Re. The blanks go away also – Bill Watts Dec 14 '17 at 9:09

EqDiff = m*D[x[t], {t, 2}] + c*D[x[t], t] + k*x[t] == f[t];