Professional Documents
Culture Documents
Matlab For Laplace Transform Inversion - Partial Fraction Expansion
Matlab For Laplace Transform Inversion - Partial Fraction Expansion
F=[1 3 2]
F = 1 3 2
Display it
poly2str(F,'s')
ans = s^2 + 3 s + 2
Evaluate it as s=1
polyval(F,1)
ans = 6
Find roots, Note that since roots are at 1 and 2 the polynomial is (s+1)(s+2)
roots(F)
ans =
‐2
‐1
H=conv(F,G)
H = 1 6 18 32 29 10 0 0
Numerator = s + 1
Denominator = s^2 + 2 s
Now use "residue" command to do inverse transform. r = magnitude of expansion term p = location of pole of each term k = constnat term (k=0
except when numerator and denominator are same order (m=n)).
http://lpsa.swarthmore.edu/LaplaceXform/InvLaplace/PFE1Matlab/html/PFE1.html 1/4
11/26/2018 Matlab for Laplace Transform Inversion / Partial Fraction Expansion
[r,p,k]=residue(n,d)
r =
0.5000
0.5000
p =
‐2
0
k = []
Note that the function is implicitly defined only for t>=0. Some texts show the time domain function multiplied by the unit step. We will keep our
expressions simpler by making that relationship implicit.
disp('Example 2: PFE with repeated real roots (at origin in this case)');
Example 2: PFE with repeated real roots (at origin in this case)
[r,p,k]=residue(n,d)
Numerator = s^2 + 1
Denominator = s^3 + 2 s^2
r =
1.2500
‐0.2500
0.5000
p =
‐2
0
0
k = []
Note, first order term (1/s) comes before the 2nd order term (1/s^2) in the Matlab results.
[r,p,k]=residue(n,d)
Numerator = 5 s^2 + 8 s ‐ 5
http://lpsa.swarthmore.edu/LaplaceXform/InvLaplace/PFE1Matlab/html/PFE1.html 2/4
11/26/2018 Matlab for Laplace Transform Inversion / Partial Fraction Expansion
Denominator = s^4 + 2 s^3 + 5 s^2
r =
‐1.0000 ‐ 1.0000i
‐1.0000 + 1.0000i
2.0000 + 0.0000i
‐1.0000 + 0.0000i
p =
‐1.0000 + 2.0000i
‐1.0000 ‐ 2.0000i
0.0000 + 0.0000i
0.0000 + 0.0000i
k = []
M = 2.8284
phi = ‐2.3562
omega = 2
alpha = 1
t=linspace(‐1,4,1000);
f=(M*exp(‐alpha*t).*cos(omega*t+phi) + r(3) + r(4)*t) .* heaviside(t);
plot(t,f,'Linewidth',2);
xlabel('Time'); ylabel('f(t)'); grid;
If the numerator and denominator have the same order, we get a constant as part of the partial fraction expansion.
http://lpsa.swarthmore.edu/LaplaceXform/InvLaplace/PFE1Matlab/html/PFE1.html 3/4
11/26/2018 Matlab for Laplace Transform Inversion / Partial Fraction Expansion
[r,p,k]=residue(n,d)
Numerator = 3 s^2 + 2 s + 3
Denominator = s^2 + 3 s + 2
r =
‐11
4
p =
‐2
‐1
k = 3
http://lpsa.swarthmore.edu/LaplaceXform/InvLaplace/PFE1Matlab/html/PFE1.html 4/4