I am trying to do the numerical laplace inverse of a very complicated transfer function, subject to a trapezoidal pulse input. For the sake of understanding, I will use a simple transfer function to pose my question. I want to find out the output value during pulse on times, but numerical laplace inverse gives highly erroneous results for such time scales. Here is the pulse input that I am giving
The mathematica code is the following:
Gtransfer[s_] = 1/(1 + s);
T1 = 10^-9;
T2 = 10*10^-9;
T3 = 10^-9;
Eo = 1;
Eint[t_] = Eo*10^9*t;
Enet[t_] =
Eint[t] - Eint[t - T1]*UnitStep[t - T1] -
Eint[t - T1 - T2]*UnitStep[t - T1 - T2] +
Eint[t - T1 - T2 - T3]*UnitStep[t - T1 - T2 - T3];
Eins[s_] = LaplaceTransform[Enet[t], t, s];
fun1[s_] = Eins[s] Gtransfer[s];
thisDir =
ToFileName[("FileName" /.
NotebookInformation[EvaluationNotebook[]])[[1]]];
SetDirectory[thisDir];
<< FixedTalbotNumericalLaplaceInversion.m
t0 = 25 10^-9;
Vnumerical = FT[fun1, t0](*Numerical*)
Vanalytical =
N[InverseLaplaceTransform[fun1[s], s, t] /. t -> 25 10^-9](*Analytical*)
You will find that for values of t0<12*10^(-9), numerical inverse laplace is extremely erroneous. Could anyone suggest me as to why this is so and how to fix this? My original transfer function is just too complicated to invert analytically. Thanks in advance!
FixedTalbotNumericalLaplaceInversion.m
or the definition ofFT
. But my guess is that this tool will use numerical integration in one or the other way. A step function of width10^-9
is just hard to integrate. Its support is probably so narrow that it lies between two quadrature points so that it cannot be detected appropriately by the method. $\endgroup$InverseLaplaceTransform[fun1[s], s, 25.0 10^-9, Method -> "Talbot", WorkingPrecision -> 20]
inMathematica 12.2.0
.Works perfectly. $\endgroup$