Labno9: Laplace Transform & Plotting Functions Laplace Transform
Labno9: Laplace Transform & Plotting Functions Laplace Transform
Laplace Transform
Where
Syntax
laplace(F)
laplace(F, t)
laplace(F, w, z)
Description
L = L(t)
Examples
f(t) = t4
syms t;
f = t^4;
laplace(f)
returns
ans =
24/s^5
syms s;
g = 1/sqrt(s);
laplace(g)
returns
ans =
pi^(1/2)/t^(1/2)
f(t) = e–at
syms t a x;
f = exp(-a*t);
laplace(f,x)
returns
ans =
1/(a + x)
-Syntax
F=ilaplace(L)
F=ilaplace(L,y)
F = ilaplace(L,y,x)
Description
F = ilaplace (L) computes the inverse Laplace transform of the symbolic expression L. This
syntax assumes that L is a function of the variable s, and the returned value is a function of t.
F = F(x)
Where c is a real number selected so that all singularities of L(s) are to the left of the line s =
c, i.
F = ilaplace(L,y,x) computes the inverse Laplace transform and lets you specify that F is a function
of x and L is a function of y.
Examples:
Inverse Laplace Transform MATLAB Command
syms s;
f = 1/s^2;
ilaplace(f)
returns
= t
ans =
t
syms a t;
g = 1/(t-a)^2;
ilaplace(g)
returns
= xeax
ans =
x*exp(a*x)
syms x u;
syms a real;
f = 1/(u^2-a^2);
simplify(ilaplace(f,x))
returns
ans =
sinh(a*x)/a
Example 1:
Example 2:
Two or more plots can be shown on the same graph as shown in this example. In this example, an
additional function "y2" is to be shown with function y plotted in Example 1 on the same graph.
Note that the "legend" function is used to label the plots. The entries in Matlab command
window are as follows:The resulting plot is shown below:
Note that markers are used in the "plot" function in Example 2 for the purpose of identification.
The table below lists all markers offered in Matlab.
Designated Used in "plot" Designated Used in "plot"
colour command linestyle command
yellow y point .
red r circle o
green g x-mark x
blue b plus +
black k star *
white w solid - (minus sign)
magenta m dotted :
cyan c dashdotted -.
dashed -- (two minus signs)
Example 3:
You may show multiple plot in an array format. This can be achieved with the "subplot"
command. You may arrange multiple plot in any array you wish, e.g., a 2 x 2 plot array
would yield two plots on the top row and two plots on the bottom row. The functions used in
Examples 1 and 2 above can be shown in an array format by the following inputs:
Example 4:
>> laplace(12*diff(sym('y(t)'),2))
Note that the function y(t) is defined as symbol with the imbedded command "sym". The
number 2 means we wish to take the second derivative of the function y(t).
Matlab result:
ans=12*s*(s*laplace(y(t),t,s)-y(0))-12*D(y)(0)
Lab Report
Read the instructions and evaluate the following by hand and through MATLAB:
Residue finds the partial fraction expansion of the ratio of two polynomials. This is
particularly useful for applications that represent systems in transfer function form. For
polynomials b and a, if there are no multiple roots,
Where r is a column vector of residues, p is a column vector of pole locations, and k is a row
vector of direct terms. Consider the transfer function
Given three input arguments (r, p, and k), residue converts back to polynomial form:
[b2,a2] = residue(r,p,k)
Convolution
Syntax
w=conv(u,v)
w = conv(...,'shape')
Description
same Returns the central part of the convolution of the same size as u.
valid Returns only those parts of the convolution that are computed without the zero-
padded edges. Using this option, length(w) is max(length(u)-max(0,length(v)-1),0).
Definitions
The sum is over all the values of j which lead to legal subscripts for u(j) and v(k+1-j),
specifically j = max(1,k+1-n): min(k,m). When m = n, this gives
w(1) = u(1)*v(1)
w(2) = u(1)*v(2)+u(2)*v(1)
w(3) = u(1)*v(3)+u(2)*v(2)+u(3)*v(1)
...
...
w(2*n-1) = u(n)*v(n)
Transfer Function
Syntax
tf
sys = tf(num,den)
sys = tf(num,den,Ts)
sys = tf(M)
sys = tf(num,den,ltisys)
tfsys = tf(sys)
Description
Use tf to create real- or complex-valued transfer function models (TF objects) or to convert
state-space or zero-pole-gain models to transfer function form. You can also use tf to create
generalized state-space (genss) models.
Creation of Transfer Functions
If all SISO entries of a MIMO transfer function have the same denominator, you can
set den to the row vector representation of this common denominator. See "Examples" for
more details.
There are several ways to create arrays of transfer functions. To create arrays of SISO or
MIMO TF models, either specify the numerator and denominator of each SISO entry using
multidimensional cell arrays, or use a for loop to successively assign each TF model in the
array. See Model Arrays in the Control System Toolbox User Guide for more information.
Any of the previous syntaxes can be followed by property name/property value pairs
'Property',Value
Each pair specifies a particular property of the model, for example, the input names or the transfer
function variable. For information about the properties of tfobjects, see Properties.
Note that
sys = tf(num,den,'Property1',Value1,...,'PropertyN',ValueN)
is a shortcut for
sys = tf(num,den)
set(sys,'Property1',Value1,...,'PropertyN',ValueN)
Read the instructions and evaluate the following by hand and through MATLAB:
3 s−2
1.
s 2−s
s 2+ 9 s−9
2. 3
s −9 s
11 s−14
3. 3 2
s −s −4 s+ 4
s
4.
( s+ 1 )2
s
5. 2
s + 2 s+2
10 ( s +1 )
6. 2
s ( s+ 4 ) ( s +6 )
Comment and Conclusion:
In this lab we learnt about the Laplace and inverse Laplace theorm. In Laplace transform of a
function f (t) can be obtained with Matlab's function ilaplace and F = ilaplace (L, y) computes
the inverse Laplace transform F as a function of y instead of the default variable t. we also
learn about the Plotting and Graphics. In this Matlab offers fairly decent scientific
visualization and graphics capabilities. In the current version, Matlab features both 2-D and
3-D graphics options. We also perform examples and lab tasks related to these experiments.
We also learn about the Partial Fraction Expansion, transfer function and convolution theorm.
Partial fraction expansion of the ratio of two polynomials. This is particularly useful for
applications that represent systems in transfer function form. For polynomials b and a, if there
are no multiple roots. Convolution is the same operation as multiplying the polynomials
whose coefficients are the elements of u and v.at the last we perform the tasks related to the
topics and calculate their results.