









































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of Computational Methods are Midair Collision, Applied Math, Row and Column Vectors, Arrays Two, Charged Particle, Optimize Distribution, Functions Two, Handles Types, Integration One. Main points of this lecture are: Ode, Learning Goals, Ordinary Differential Eqns, Possible Use Analytical, Accuracy, Numerical Soln, Approximations, Solutions, Nonlinear, Matlab Ode Solvers
Typology: Slides
1 / 49
This page cannot be seen from the preview
Don't miss anything!










































Solver Problem Type Order of Accuracy When to Use ode45 Nonstiff Medium Most of the time. This should be the first solver you try. ode23 Nonstiff Low For problems with crude error tolerances or for solving moderately stiff problems. ode113 Nonstiff Low to high For problems with stringent error tolerances or for solving computationally intensive problems.
ode15s Stiff Low to medium If ode45 is slow because the problem is stiff.
ode23s Stiff Low If using crude error tolerances to solve stiff systems and the mass matrix is constant. ode23t Moderately Stiff Low For moderately stiff problems if you need a solution without numerical damping. ode23tb Stiff Low If using crude error tolerances to solve stiff systems.
1 2 0
2 1 2 2 0 2
2
1 1 2 1 0 1
1
m m m m
m
m
m
f t y y y y t b dt
dy
f t y y y y t b dt
dy
f t y y y y t b dt
dy
m-Eqns (1st^ order ODEs) in m-Unknowns
y = f y y = b
If we have written ROW vectors for the y & b quantities can Transpose to Column-Vectors
yT = [ y 1 (^) ; y 2 ;; ym ]
b T =^ [ b^1 (^) ; b 2 ;; bm ]
2
1 (^1) dt y x
dy dt
dx x = = = =
ReArranging the ODE to isolate Highest order term
x 2 (^) = sin t − 5 x 1 − 2 x 2
Thus the 1 st^ Order Eqn System in 2 Vars
1 2
2 2
2
1 1
sin t 5 x 2 x dt
dx x
x dt
dx x
= = − −
= =
0 0 73
2
1 = =
= =
y x
y x
And also dx 2 /dt
x 1 = y x 2 = y
Converted the SINGLE 2 nd^ Order ODE to a LINEAR System of TWO 1 st Order ODEs
Sub into ODE
= 2
(^2) y y x dt
d dt
dx
2
(^1) y x dt
dy dt
dx = = =
y + 2 y + 5 y = sin t
x x t dt
dx (^2) + 2 2 + 5 1 = sin
Example ode45 (5)
0
=
t
( )
sin 5 2 ( 0 ) 2
0 73
1 2 2
2
2 1
1
= − − = =
= = =
t x x x t dt
dx
x x t dt
dx
The final xForm
Example ode45 (6)
( )
sin 5 2 (^0 )^2
1 2 2
2
2 1
1
t x x x t dt
dx
x x t dt
dx
( , , ), ( ) ,
( , , ), ( ) ,
2 1 2 2 0 2 2
1 1 2 1 0 1 1
f t y y y t b dt
dy
f t y y y t b dt
dy
= =
= =
% Bruce Mayer, PE * 05Nov11 % ENGR25 * Lec24 on MATLAB ODE solvers % file = Demo_ODE_Lec24.m % Revised to include a set of non-zero ICs % %This script file calls FUNCTION xdot_lec % clear % clear memory % % CASE-I => set the IC's y(0) & dy(0)/dt as COL Vector % y0=[0; 0]; % comment-out if Not Used % CASE-II => set the IC's y(0) & dy(0)/dt as COL Vector y0=[-0.19; -0.73]; % Comment-Out if Not Used % % Default Time Interval of 20 Time-Units; user can change this tmax = input('input tmax = ') trng = [0, tmax]; % % %Call the ode45 routine with the above data inputs [t,y]=ode45('xdot_lec24', trng, y0); % %Plot the first column of the solution “matrix” %giving x1 or y. plot(t,y, 'LineWidth', 2), xlabel('t'), ylabel('ODE Solution y(t) & dy/dt'),... title('ODE Example - Lecture24'), grid, legend('y(t)','dy/dt')
0 2 4 6 8 10 12 14 16 18 20
-0.
-0.
-0.
-0.
-0.
0
Time, t
ODE Solution, y(t)