This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ode45- Differential Equation Solver This routine uses a variable step Runge-Kutta Method to solve differential equations numerically. The syntax for ode45 for first order differential equations and that for second order differential equations are basically the same. However, the .m files are quite different. I. First Order Equations ( y = f ( t,y ) y ( t ) = y A. Create a .m file for f ( t,y ) (see the tutorial on numerical methods and m files on how to do this). Save file as, for example, yp.m . B. Basic syntax for ode45 . At a Matlab prompt type : [t,y]=ode45(’yp’,[t0,tf],y0); (your version of ode45 may not require brackets around t0, tf) yp= the .m file of the function f ( t,y ) saved as yp.m t0, tf = initial and terminal values of t y0 = initial value of y at t C. For example, to numerically solve ( t 2 y = y + 3 t y (1) =- 2 over the interval 1 ≤ t ≤ 4 : • Create and save the file yp.m for the function 1 t 2 ( y + 3 t )....
View Full Document
This note was uploaded on 09/05/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.
- Spring '09