Finding Laplace transforms using MATLAB

advertisement
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).
Examples: See the following pages
1
EGR 261 – Laplace Transforms using MATLAB
Examples – using MATLAB
L tu(t)


L 2 - ae
- 2t
Verify the following relationships:
1
s
2
 be
- 3t
u(t)   2 s
L 10cos(2t)u (t)  
L 10u(t - 4)  
10e
s
10s
s 4
2
- 4s
a
s2

b
s3
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)
B) i(t) = 10te-2tu(t)
C) v(t) = 10e-3tcos(4t)u(t)
D) f(t) = 10t2e-3tu(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)
3
EGR 261 – Laplace Transforms using MATLAB
4
Unit step functions
The unit step function, u(t), is sometimes called a Heaviside function.
u(t)
Recall that u(t) is defined as follows:
0
u(t)  
1
t0
1
t0
t
0
Sometimes the unit step function is defined as:
 0

u(t)   0.5
 1

t0
u(t)
t0
1
t0
0.5
t
0
The heaviside( ) function in MATLAB is defined like the second definition of
u(t) above
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:
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
t
0
2
6
5
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 2nd 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
Download