0% found this document useful (0 votes)
162 views8 pages

Inverse Laplace Transforms With MATLAB

The document describes two methods for finding the inverse Laplace transform in MATLAB: 1) Using the built-in residue function to obtain the partial fraction expansion and write down the inverse Laplace transform expression. 2) Using MATLAB's symbolic calculation and ilaplace function to define the Laplace domain function, operate on it, and calculate the inverse Laplace transform. The document provides an example RC circuit problem and MATLAB code to demonstrate both methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views8 pages

Inverse Laplace Transforms With MATLAB

The document describes two methods for finding the inverse Laplace transform in MATLAB: 1) Using the built-in residue function to obtain the partial fraction expansion and write down the inverse Laplace transform expression. 2) Using MATLAB's symbolic calculation and ilaplace function to define the Laplace domain function, operate on it, and calculate the inverse Laplace transform. The document provides an example RC circuit problem and MATLAB code to demonstrate both methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Inverse Laplace Transforms (MATLAB)

Purpose:
The Laplace Transform converts the integral
-
differential equations of electromechanical system into
algebra
-
based equations that can be easily manipulated. However, evaluating the inverse
Laplace
transfor
m can be cumbersome. This lab will introduce some tools in MATLAB that can be
used to find
the inverse Laplace transform.
Procedure:
Fig. 1: RC Circuit with a Switch
The switch closes at
t
= 0. The output is the capacitor voltage.
Select your own valu
es of
R
and
C
. Treat all components as “resistors” and solve for
V
B
in the Laplace
domain.
The voltage divider gives
s
RC
s
V
s
V
sRC
s
V
sC
R
sC
s
V
in
in
in
out







2
1
1
)
(
1
1
)
(
.
The time
-
domain solution requires us to find the inverse Laplace transform.
Method 1
: Using the MAT
LAB built
-
in function residue
Let the denominator be
]
0
1
[
RC
a

and the numerator be
in
V
b

Then the MATLAB function [r, p, K] = residue(b, a) finds the partial fraction
expansion:
K
p
s
r
p
s
r
s
a
s
b





)
2
(
)
2
(
)
1
(
)
1
(
)
(
)
(
Once the partial fraction expansion is obtained, you can write down the inverse
Laplace transform:
)
(
)
2
(
)
1
(
)
(
)
2
(
)
1
(
t
K
e
r
e
r
t
v
t
p
t
p
B





Now plot
v
B
(t)
to ensure that it depicts a charging capacitor. See the Appendix.
Note:
Here we as
sume that we have only simple poles. When the order of the numerator b is lower
than the order of the denominator a, we always have K = 0.
Method 2
: Using the MATLAB’s symbolic calculation and function ilaplace
As an exercise, run the following MATLAB scri
pt to learn about MATLAB’s laplace and ilaplace :
syms t %time variable t
f=2*exp(
-
t)
-
2*t*exp(
-
2*t)
-
2*exp(
-
2*t); %define f(t)
pretty(f) %looks better
F=laplace(f) %Laplace transform
pretty(F) %looks better
F=simplify(F) %combin
e partial fractions
fnew=ilaplace(F) %inverse Laplace transform
pretty(f) %looks better
Now you are ready to do the lab using the second method.
i. Defining the symbolic variables to be used (i.e.
s
)
>> syms s
ii. Writing the Laplace domain func
tion
>> F = b/(R*C*s^2 + s)
iii. Operating on the function
>> f = ilaplace(F)
Now plot
v
B
(t)
to ensure that it depicts a charging capacitor. See the Appendix.
Conclusions:
(1)
Did these two methods give you the same mathematical expression for the inve
rse Laplace
transform?
(2)
Type
(or write)
these two time
-
domain expressions here.
(3)
Run a
Multisim
simulation to verify the time
-
domain
v
B
(
t
) is reasonably correct.
Appendix
: Suggested MATLAB code (Please change your values of
R
and
C
)
clc;
%reset the
workspace command line
clear
all
;
%clear all the variables
close
all
;
%close all the plots
%%====Please use your own value for R and C===================
R = 10000;
%10kohm
C = 0.1*10^(
-
6);
%0.1 uF
%%=======================================================
=====
vin = 5;
%input amplitude=5 V
a = [R*C 1 0];
%denominator
b = vin;
%numerator
%%=========For Plotting==================
set(gca,
'fontsize'
,18,
'FontWeight'
,
'bold'
,
'FontName'
,
'Times New Roman'
);
%%=======================================
% Method 1: Re
sidue
display(
'Method1: Residue'
);
[r, p, K] = residue (b, a)
t=0:0.0001:0.01;
VB=r(1)*exp(p(1)*t)+r(2)*exp(p(2)*t);
subplot(1,2,1)
plot(t, VB)
xlabel(
'Time[s]'
);
ylabel(
'Voltage [V]'
);
title(
'Method 1: Residue'
)
%%%===================================
%
Method 2: Symbolic
display(
'Method2: Symbolic'
);
syms
s
F = b/(a(1)*s^2+a(2)*s)
f = ilaplace(F)
subplot(1,2,2)
ezplot(f, [0, 0.01]);
%ezplot plots function f over the specified range
xlabel(
'Time[s]'
);
ylabel(
'Voltage [V]'
);
title(
'Method 2: Symbolic'

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

How to find inverse Laplace Transforms


using MATLAB ?
In this article, we will see how to find Laplace Transform in MATLAB. Laplace
Transform helps to simplify problems that involve Differential Equations into
algebraic equations. Inverse Laplace Transform converts Laplace Domain
Function F(s) into time-domain function f(t)
Using the above function one can generate a Time-domain function of any
Laplace expression.
Example 1: Find the Inverse Laplace Transform of 

% specify the variable a, t and s 


% as symbolic ones
syms a t s
  
% define function F(s) 
F = s/(a^2 + s^2);
  
% ilaplace command to transform into time
% domain function f(t)  
% Inverse Laplace Function
f1=ilaplace(F,s,t);
  
% Display the output value
disp(f1);
  
% Output can be verified by transforming 
% function f1 into Laplace Domain F(s)
f=laplace(f1,t,s);  % Laplace Function
disp(f);

% specify the variable a, t and 


% s as symbolic ones
syms a t s
  
% define function F(s) 
F = 1/(s-a);
  
% ilaplace command to transform into
% time domain function f(t)
% Inverse Laplace Function
f1=ilaplace(F,s,t); 
  
% Display the output value
disp(f1);
% Output can be verified by transforming 
% function f1 into Laplace Domain F(s)
f=laplace(f1,t,s);  % Laplace Function
disp(f);
% specify the variable a, t and 
% s as symbolic ones
syms a t s
  
% define function F(s) 
F = 2/(s+1)+3/(s+2)+1/s;
  
% ilaplace command to transform into
% time domain function f(t)  
% Inverse Laplace Function
f1=ilaplace(F,s,t);
% Display the output value
disp(f1);
  
%Output can be verified by transforming 
% function f1 into Laplace Domain F(s)
f=laplace(f1,t,s);  % Laplace Function
disp(f);

You might also like