150 likes | 905 Views
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.
E N D
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
EGR 261 – Laplace Transforms using MATLAB Examples – using MATLAB Verify the following relationships:
EGR 261 – Laplace Transforms using MATLAB Examples Find Laplace transforms for the some of the following functions and use MATLAB to verify the results. v(t) = 10sin(4t)u(t) i(t) = 10te-2tu(t) v(t) = 10e-3tcos(4t)u(t) f(t) = 10t2e-3tu(t) i(t) = 4e-2(t - 3)u(t - 3)} v(t) = 10e-2(t - 4)sin(6[t - 4])u(t – 4) 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: Sometimes the unit step function is defined as: u(t) u(t) 1 1 0.5 The heaviside( )function in MATLAB is defined like the second definition of u(t) above t t 0 0
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 2 6 0
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
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.
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.
EGR 261 – Laplace Transforms using MATLAB MATLAB Examples: