ode - ode45- Differential Equation Solver This routine uses...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 backets 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 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 01/18/2012 for the course MATH 366 taught by Professor Edraygoins during the Fall '09 term at Purdue.

Page1 / 2

ode - ode45- Differential Equation Solver This routine uses...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online