In this topic, we will find out how to calculate inverse Laplace of a transfer function using Matlab.
Let’s find out Inverse Laplace of the following function
\[X(s)\frac{10{{s}^{2}}+20s+40}{{{s}^{3}}+12{{s}^{2}}+47s+60}=\frac{Numerator}{Denumerator}\]
Let’s write a little code in Matlab now:
%% % Calculate Inverse Laplace of a function using Matlab %Let's write numerator and denumerator from the given transfer function num = [10 20 40]; % Numerator Coefficients den = [1 12 47 60]; %Denumerator Coefficients % "residue" command is used to do Partial Fraction Operation &; % returns "residue", and "Poles" and direct term of the partial fraction % expansion % Write "help residue" in Maltab GUI to get better insight [Residue,Poles,Direct_Term] = residue(num,den)
Results:
Here, we get the following results:
Residue =
95.0000
-120.0000
35.0000
Poles =
-5.0000
-4.0000
-3.0000
Direct_Term =
[]
Using above mentioned results, let’s write the partial fraction expansion of the function X(s)
\[X(s)=\frac{95}{s+5}-\frac{120}{s+4}+\frac{35}{s+3}\]
From partial fraction expression, we can easily write the inverse Laplace transform as:
$x(t)=95{{e}^{-5t}}-120{{e}^{-4t}}+35{{e}^{-3t}}$
In order to convert partial fraction expansion back to the original function, we can use the following Matlab command:
\[[b,a]\text{ }=\text{ }residue(r,p,k)\]
Here, we have b (coefficients for numerator) and a (coefficients for denumerator) to write the function like X(s).
You May Also Read: Laplace Transform: Introduction and Example