Finding inverse Laplace Transforms using Matlab
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alicia Stier
el 12 de Feb. de 2019
Comentada: Star Strider
el 13 de Feb. de 2019
Does anyone know how to get the inverse laplace transform in MATLAB? Ideally entering the Laplace form of the equation, and getting the output in the time domain.
Thanks!!
P.S. if you have an example you're willing to share that would be appreciated!
1 comentario
Respuesta aceptada
Star Strider
el 12 de Feb. de 2019
A reasonably illustrative example:
syms H(s) s t
H(s) = (s^2 + 3*s + 5)/(s^3 + 5*s^2 +6*s + 9);
Hpf = partfrac(H)
h(t) = vpa(ilaplace(Hpf,s,t))
hfcn = matlabFunction(h)
producing:
h(t) =
0.6241318855835944579323146742924*exp(-4.0690229960401146971234049368325*t) + 0.3758681144164055420676853257076*exp(-0.46548850197994265143829753158373*t)*cos(1.4124990678323177947660216914026*t) + 0.50589008998062620975227487302694*exp(-0.46548850197994265143829753158373*t)*sin(1.4124990678323177947660216914026*t)
and (after a bit of editing):
hfcn = @(t)exp(t.*-4.069022996040115).*6.241318855835945e-1+exp(t.*-4.654885019799427e-1).*cos(t.*1.412499067832318).*3.758681144164055e-1+exp(t.*-4.654885019799427e-1).*sin(t.*1.412499067832318).*5.058900899806262e-1
Using the partfrac (partial fraction decomposition) function is frequently necessary. You can use the vpa function to simplify expressions that cannot easily be simplified using the simplify and related functions. The matlabFunction function will convert the expressions into executable numeric (as opposed to symbolic) code.
If you are using the Symbolic Math Toolbox to work with control systems, use the sym2poly function to export your symbolic polynomial coefficients to create transfer functions with the other Toolboxes.
2 comentarios
Star Strider
el 13 de Feb. de 2019
Not really.
I experimented with setting the vpa resolution to 5 (so a 5-digit display while retaining full internal precison), however that appears not to be possible, largely because of the transcendental function arguments that, along with exponents, are always displayed at full precision.
This will provide a bit of simplification:
syms H(s) s t
H(s) = (s^2 + 3*s + 5)/(s^3 + 5*s^2 +6*s + 9);
Hpf = partfrac(H);
h(t) = vpa(ilaplace(Hpf,s,t));
h(t) = collect(h(t), 'exp')
hfcn = matlabFunction(h);
producing (with the collect call):
h(t) =
0.6241318855835944579323146742924*exp(-4.0690229960401146971234049368325*t) + (0.3758681144164055420676853257076*cos(1.4124990678323177947660216914026*t) + 0.50589008998062620975227487302694*sin(1.4124990678323177947660216914026*t))*exp(-0.46548850197994265143829753158373*t)
That’s as likely as good as it gets. If you do not use the vpa function, the decimal fractions will instead be long fractions that are difficult to interpret.
If you want a numerical time-domain solution, I would use the ‘hfcn’ output and be done with it. You are certainly free to experiment yourself to see if your inverse Laplace results are more tractable. They may be. My code is simply an illustration.
Más respuestas (0)
Ver también
Productos
- MATLAB and Simulink Student Suite
- Control System Toolbox
- DSP System Toolbox
- Data Acquisition Toolbox
- Instrument Control Toolbox
- Image Processing Toolbox
- Optimization Toolbox
- Partial Differential Equation Toolbox
- Signal Processing Toolbox
- Simulink Control Design
- Statistics and Machine Learning Toolbox
- Symbolic Math Toolbox
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!