Transcript Finding Laplace transforms using MATLAB
EGR 261 – Laplace Transforms using MATLAB
Finding Laplace transforms using MATLAB
MATLAB has a powerful function
laplace( )
for finding Laplace transforms.
laplace(F)
- the Laplace transform of symbolic F with default independent variable t. The default return is a function of s. The Laplace transform is applied to a function of t and returns a function of s.
laplace(F, z)
- returns a function of z instead of a function of s -
laplace(F, s)
is the same as
laplace(F) laplace(F, w, z)
- finds the transform as a function of w and returns a function of z -
laplace(F, t, s)
is the same as
laplace(F) Note:
Since we are using one-sided Laplace transforms, there is an implied u(t) associated with functions. So to find
L(tu(t)),
use
laplace (t)
.
1
Examples: See the following pages
EGR 261 – Laplace Transforms using MATLAB
Examples – using MATLAB
Verify the following relationships: L 1 s 2 L 2 ae 2t be 3t u(t) 2 s s a 2 s b 3 L 10cos(2t)u (t) s 2 10s 4 L 10u(t 4) 10e s 4s 2
EGR 261 – Laplace Transforms using MATLAB
Examples
Find Laplace transforms for the some of the following functions and use MATLAB to verify the results.
A) v(t) = 10sin(4t)u(t) 3 B) i(t) = 10te -2t u(t) C) v(t) = 10e -3t cos(4t)u(t) D) f(t) = 10t 2 e -3t u(t) E) i(t) = 4e -2(t - 3) u(t - 3)} F) v(t) = 10e -2(t - 4) sin(6[t - 4])u(t – 4) G) f(t) = 10tcos(3t)u(t)
EGR 261 – Laplace Transforms using MATLAB
Unit step functions
The
unit step function
, u(t), is sometimes called a
Heaviside function
.
Recall that u(t) is defined as follows:
u(t)
u(t) 0 1 t 0 t 0
1 t 0
Sometimes the unit step function is defined as: 0 t 0
u(t)
u(t) 0.5
1 t t 0 0
0.5
1 t 0
The
heaviside( )
function in MATLAB is defined like the second definition of u(t) above 4
EGR 261 – Laplace Transforms using MATLAB
Graphing unit step functions and piecewise-continuous functions in MATLAB
As noted earlier, the
heaviside( )
function can be used to represent a unit step function.
The waveform below (from an earlier example) could be formed using: 5
20*t.*(heaviside(t-2) – heaviside(t-6));
See the next slide for more details.
“window function” 20t[u(t-2) – u(t-6)] 120 40 0 2 6 t
EGR 261 – Laplace Transforms using MATLAB
MATLAB Example
u1: u(t) vs t u2: u(t-2) vs t u3: u(t)-u(t-2) vs t
6
EGR 261 – Laplace Transforms using MATLAB
Finding derivatives in MATLAB
diff(f )
– finds the derivative of symbolic function f
diff(f, 2)
– finds the 2 nd derivative of f (same as diff(diff(f)) If f is a function of both x and y,
diff(f, x)
– partial derivative of f w.r.t. x
diff(f, y)
– partial derivative of f w.r.t. y
Examples
: (shown to the right) Before proceeding with more advanced derivatives and applications, it may be useful to discuss different ways of
representing functions in MATLAB
.
7
EGR 261 – Laplace Transforms using MATLAB
Performing integration in MATLAB
int(S)
– finds the
indefinite integral
of a symbolic expression S with respect to its symbolic variable (or variable closest to x)
int(S, z)
– finds the
indefinite integral
of a symbolic expression S with respect to z
int(S, a, b)
– finds the
definite integral
of a symbolic expression S from a to b with respect to its symbolic variable (or variable closest to x)
int(S, z, a, b)
– finds the
definite integral
of a symbolic expression S from a to b with respect to z
double(int(S, z, a, b))
– finds a numeric result for the
definite integral
of a symbolic expression S from a to b with respect to z. This is useful in cases where MATLAB can’t find a symbolic solution.
8
EGR 261 – Laplace Transforms using MATLAB
MATLAB Examples:
9