Contents

Matlab for Laplace Transform Inversion / Partial Fraction Expansion

disp(' '); disp(' '); disp('Example 1: PFE with distinct real roots');
 
 
Example 1: PFE with distinct real roots

First Example - Simplest case - distinct real roots

This case will consider only distinct real roots.

Define numerator and denominator polynomial.

n=[1 1];                %n=s+1
d=conv([1 0],[1 2]);    %Use "conv" to multiply polynomial
disp(['Numerator = ' poly2str(n,'s')]);
disp(['Denominator = ' poly2str(d,'s')]);
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)).

[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(' '); disp(' '); disp('Example 2: PFE with repeated real roots');
 
 
Example 2: PFE with repeated real roots

Second Example - Repeated roots at origin

Define numerator and denominator polynomial.

n=[1 0 1];              %n=s^2+1
d=conv([1 0 0],[1 2]);  %Use "conv" to multiply polynomial
disp(['Numerator = ' poly2str(n,'s')]);
disp(['Denominator = ' poly2str(d,'s')]);

[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, second order pole (s^2) comes second in list.

 -
 -
disp(' '); disp(' '); disp('Example 3: PFE with complex conjugate roots.');
 
 
Example 3: PFE with complex conjugate roots.

Third Example - Complex Conjugate roots

We also did this example in class.

Define numerator and denominator polynomial.

n=[1 0 1];                %n=s^2+1
d=conv([1 0 0],[1 2 5]);  %Use "conv" to multiply polynomial
disp(['Numerator = ' poly2str(n,'s')]);
disp(['Denominator = ' poly2str(d,'s')]);

[r,p,k]=residue(n,d)
Numerator =    s^2 + 1
Denominator =    s^4 + 2 s^3 + 5 s^2

r =

   0.0400 - 0.2200i
   0.0400 + 0.2200i
  -0.0800          
   0.2000          


p =

  -1.0000 + 2.0000i
  -1.0000 - 2.0000i
        0          
        0          


k =

     []

Note, first two roots are complex conjugate roots.

Get magnitude and phase from magnitude and phase of pfe Refer to notes from last class

M=2*abs(r(1))       %Magnitude of cosine
phi=angle(r(1))     %Phase of cosine
M =

    0.4472


phi =

   -1.3909

Get frequency and decay rate from location of pole

omega=imag(p(1))
alpha=-real(p(1))
omega =

     2


alpha =

     1

Plot the response

t=0:0.1:4;
f=M*exp(-alpha*t).*cos(omega*t+phi) + r(3) + r(4)*t;
plot(t,f);
xlabel('Time');
ylabel('f(t)');
 -
 -
disp(' '); disp(' '); disp('Example 4: PFE: order of num=order of den');
 
 
Example 4: PFE: order of num=order of den

Fourth Example - Order of numerator=order of denominator

We also did this example in class.

Define numerator and denominator polynomial.

n=[3 2 3];          %n=3s^2+2s + 3
d=[1 3 2];          %d=s^2+3s+2=(s+1)(s+2)
disp(['Numerator = ' poly2str(n,'s')]);
disp(['Denominator = ' poly2str(d,'s')]);

[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

Note this time that k is not empty, k=3.