Differential Equations - PowerPoint PPT Presentation

About This Presentation
Title:

Differential Equations

Description:

Differential Equations (Plus Symbolic Mathematics) Prof. Muhammad Saeed * Mathematical Modeling and Simulation Using MATLAB Symbolic Math syms x y z a b ; 1. – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 13
Provided by: Haris9
Learn more at: https://profmsaeed.org
Category:

less

Transcript and Presenter's Notes

Title: Differential Equations


1
Differential Equations
(Plus Symbolic Mathematics)
Prof. Muhammad Saeed
2
  • Symbolic Math
  • syms x y z a b
  • 1. Expansion
  • expand((xa)3) expand(sin(ab))
  • 2. Factorization
  • factor(a2-b2)
  • 3. Series Summation
  • syms k n
  • symsum(k,0,10)symsum(k2,1,4)sysmsum(k,0,n-1)
  • 4. Substitution
  • Exprx26x9 subs(Expr,x,2) subs(Expr,x,a)
  • 5. Solution of Equations
  • solve(3x32x2-4x120)
  • solve(3x32x2-4x12)
  • solve(sin(2x)-cos(x)0)
  • 6. Solution of Simultaneous Equations
  • eqn14x3y5 eqn22x2y-3
  • Ssolve(eqn1,eqn2) S.x, S.y
  • Ssolve(eqn1,eqn2, .)

3
  • Symbolic Math
  • 7. Limit
  • limit(sin(x)/x)
  • f sin(x)/x
  • limit(f) limit(f,a) limit(f, x,a,)
    limit(f,x,a,right)
  • limit(f,x,a,left)
  • 8. Taylor Series
  • fexp(x) taylor(f, 5) taylor(f, 5,2)
  • 9. Graph Plot
  • ezplot(f, -3 3)
  • 10. Differentiation
  • syms x n
  • diff(xn)
  • diff((sin(x))2)
  • diff(xsin(xy), y, 2)

4
  • Symbolic Math
  • 11. Integration
  • syms x y n a b
  • int(xn)
  • int(xn, n)
  • int(xy2,y,0,4)
  • int(x3, a,b)
  • 12. Laplace Transform
  • syms s b t w x
  • laplace(t3)
  • laplace(exp(-bt)) laplace(exp(as))
  • laplace(sin(wx),t) laplace(cos(xw),w,t)
  • laplace(diff(sym('F(t)')))

5
  • Symbolic Math
  • 13. Inverse Laplace Transform
  • ilaplace(1/s3)
  • ilaplace(1/(sb)
  • ilaplace(b/(s2b2))
  • 14. More to study
  • fourier, ifourier,
  • ztrans, iztrans,
  • sym,
  • poly2sym, sym2poly
  • findsym,
  • simplify,
  • collect
  • See for DE solution using Laplace Transform
    DESymb.m

6
  • Symbolic Solution of Differential Equations
  • ? dsolve(Dy2y 12)
  • ? dsolve(Dy sin(at))
  • ? dsolve(D2y c2y)
  • ? x, y dsolve(Dx 3x4y, Dy
    -4x3y)
  • ? dsolve(Dy sin(at), y(0) 0) y(0)
    c
  • ? dsolve(D2y c2y,y(0) 1,Dy(0) 0)
  • ? x, y dsolve(Dx 3x4y, Dy
    -4x3y,x(0) 0,y(0) 1)
  • ? dsolve(D2y9sin(y) 0,y(0) 0,y(L)
    0)

7
  • Numeric Solution of Differential Equations
  • 1. Eulers Method. Example DEEulersMethod.m
  • 2. MATLAB ODE Solvers



Solver Solves These Kinds of Problems Method
ode45 Nonstiff differential equations Runge-Kutta
ode23 Nonstiff differential equations Runge-Kutta
ode113 Nonstiff differential equations Adams
ode15s Stiff differential equations and DAEs NDFs (BDFs)
ode23s Stiff differential equations Rosenbrock
ode23t Moderately stiff differential equations and DAEs Trapezoidal rule
ode23tb Stiff differential equations TR-BDF2
ode15i Fully implicit differential equations BDFs
8
  • Numeric Solution of Differential Equations

a) DEs Of Order 1 t, ysolver(func,ti
tj, y(i)) function ydotfuncName(t,y) ydot
f(y,t). end ODEs
b) DEs Of Order 2 t,
xsolver(function,ti, tj,y(i),
y(j)) function xdotfuncName(t,x) xdot(1)x
(2) xdot(2) func( x(1), x(2), t
) xdotxdot(1)xdot(2) end ODE
,van der Pol Eqn.
9
  • Numeric Solution of Differential Equations

Examples I. DEs Of Order 1

function ydot DEorder1_01(t,y) ydot
sin(t) end
t,y ode23(DEorder1_01, 0, 4pi,
0) Analytic Solution y 1-cos(t)
10
  • Numeric Solution of Differential Equations

Examples 2. DEs Of Order 2

( van der Pol Eqn. )
function ydot vdpol(t,y) mu 2 ydot(1)
y(2) ydot(2) mu(1-y(1)2)y(2) y(1) ydot
ydot(1) ydot(2) end
t,y ode45(vdpol, 0, 20,2 0)
11
  • Numeric Solution of Differential Equations

Examples 2. DEs Of Order 2

( van der Pol Eqn. )
function ydot vdpol2((t,y,mu) ydot(1)
y(2) ydot(2) mu(1-y(1)2)y(2) y(1) ydot
ydot(1) ydot(2) end
optionsodeset(Refine,4) t,y
ode45(vdpol, 0, 20, 2 0, options, 2)
12
END
Write a Comment
User Comments (0)
About PowerShow.com