0% found this document useful (0 votes)
12 views3 pages

Week 7

This document contains information about Laplace transforms including taking the Laplace transform and inverse Laplace transform of functions, using Laplace transforms to solve initial value problems, and finding the Laplace transform of unit step and delta functions. Examples of each are provided.

Uploaded by

education1354
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Week 7

This document contains information about Laplace transforms including taking the Laplace transform and inverse Laplace transform of functions, using Laplace transforms to solve initial value problems, and finding the Laplace transform of unit step and delta functions. Examples of each are provided.

Uploaded by

education1354
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Table of Contents

Laplace transform and inverse Laplace transform ...................................................................................... 1


Solve an IVP using Laplace transforms ................................................................................................... 1
Laplace transform of the unit step and delta functions ................................................................................ 2
solve an IVP using Laplace transforms .................................................................................................... 2

Laplace transform and inverse Laplace trans-


form
% take the Laplace transform of f(t)
syms t s a
f(t) = exp(a*t);
laplace(f,t,s)

% take the inverse Laplace transform of F(s)


syms t s
F(s) = 1/(s*(s+1));
ilaplace(F,s,t)

% calculate the partial fraction expansion of F(s)


partfrac(F,s)

ans =

-1/(a - s)

ans =

1 - exp(-t)

ans(s) =

1/s - 1/(s + 1)

Solve an IVP using Laplace transforms


% define the independent and dependent variables
syms y(t) Y s
% define the differential equation
eqn = diff(y,t,2)-2*diff(y,t)-3*y==0;
% define the initial condition
y0 = 5; dy0 = 7;
% take the Laplace transform of the ODE
Leqn = laplace(eqn,t,s);

1
% insert the ICs and simplify the expression
Leqn = subs(Leqn,[laplace(y,t,s),y(0),subs(diff(y(t),t),t,0)],[Y,y0,dy0]);
% solve for Y(s)
Ysol = solve(Leqn,Y);
% find the solution by taking the inverse Laplace transform
ysol = ilaplace(Ysol,s,t)

ysol =

2*exp(-t) + 3*exp(3*t)

Laplace transform of the unit step and delta


functions
% define the symbolic variables
syms t s a
assume(a<0)
% specify the functions
u(t) = heaviside(t);
d(t) = dirac(t);
% calculate the Laplace transforms
Lu = laplace(u(t-a),t,s)
Ld = laplace(d(t-a),t,s)

Lu =

1/s

Ld =

solve an IVP using Laplace transforms


% define the independent and dependent variables and constants
syms q(t) Q s R C e0 a b
assume(a>0 & b>a)
% define the differential equation
eqn = R*diff(q,t)+1/C*q==e0*(heaviside(t-a)-heaviside(t-b));
% define the initial condition
q0 = 0;
% take the Laplace transform of the ODE
Leqn = laplace(eqn,t,s);
% insert the ICs and simplify the expression
Leqn = subs(Leqn,[laplace(q,t,s),q(0)],[Q,q0]);
% solve for Q(s)
Qsol = solve(Leqn,Q);

2
% find the solution by taking the inverse Laplace transform
qsol = ilaplace(Qsol,s,t);

% specify the constants and plot


qsol1 = subs(qsol,[R C e0 a b],[1 1 5 1 3]);
fplot(qsol1,[0 5])
xlabel('t'), ylabel('q'), ylim([0 5])
title('The charge in a capacitor in an RC circuit')

Published with MATLAB® R2024a

You might also like