
Inverse Laplace transform - there has to be a better way?
    46 views (last 30 days)
  
       Show older comments
    
    Mark Rzewnicki
      
 on 6 Nov 2019
  
    
    
    
    
    Commented: Star Strider
      
      
 on 7 Nov 2019
            I have a transfer function 
  and I am applying a step input 
.  My ultimate goal is to find the time response 
.
Solving by hand, I know that output 
.
Then by partial fraction expansion I know that 
.
From the above I can easily take the inverse Laplace transform and see that 
.
My goal is to obtain 
with as few keystrokes as possible.
The fastest way I have found is to perform the partial fraction expansion using residue():
num = 9;
denom = [1 9 9 0];
[r,p,k] = residue(num,denom);
which gives the result:
r =
    0.1708
   -1.1708
    1.0000
p =
   -7.8541
   -1.1459
         0
k =
     []
From which I can write:
sym s
F = 0.1708/(s+7.8541) -1.1459/(s+1.1708) + 1/s;
ilaplace(F)
which gives the result:
ans =
(427*exp(-(78541*t)/10000))/2500 - (11459*exp(-(2927*t)/2500))/10000 + 1
which is the answer I want!
But there has to be a better way of doing this! Can someone please advise?
0 Comments
Accepted Answer
  Star Strider
      
      
 on 6 Nov 2019
        Try this: 
syms s t 
num = 9;
denom = [1 9 9 0];
% [r,p,k] = residue(num,denom);
nums = num;
dens = poly2sym(denom, s);                              % Create Symbolic Polynomial
F = nums / dens * 1/s                                   % Transfer Function With Step Input
Fpf = partfrac(F)                                       % Partial Fraction Expansion
f = ilaplace(Fpf)                                       % Time Domain Expression
f = rewrite(f, 'exp')                                   % Rewrite As Exponential Terms
f = vpa(f,4)                                            % Convert Fractions To Decimal Equivalents
flatex = latex(f)                                       % LaTeX Expression
producing: 

2 Comments
  Star Strider
      
      
 on 7 Nov 2019
				As always, my pleasure!  
The partfrac function was introduced in R2015a, and seems to be invoked automatically in the last two or three releases.  It was not automatic before then, so I specifically included it here.  
More Answers (0)
See Also
Categories
				Find more on Calculus in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!