{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

math245lab03

# math245lab03 - Math245 Computer Lab set#3 Fall 2008 Solve...

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

Math245 Computer Lab set #3, Fall 2008 Solve the 1-st order ODE by using Matlab We consider the 1-st order ODE in the form dy dt = f ( t, y ) , with initial condition y (0) = y 0 . To obtain the numerical solution to this initial value problem, we will use ODE solver ode45 (Runge-Kutta 4-5th order method) in Matlab package. The simplest use of ode45 is in the following form: [ t, y ] = ode45(@odefun, tspan, initvalue); @odefun : (IN) information of Matlab function file where f ( t, y ) is defined. tspan : (IN) interval of independent variable t , e.g., [t0 tend] (vector with two elements). initvalue : (IN) initial value. t : (OUT) time (independent variable) vector. y : (OUT) solution vector which corresponds to the time vector t . The output variables ( t and y ) are in the row vector form. The structure of these vectors are described as follows. t = t 0 t 1 t 2 . . . t end , y = y ( t 0 ) y ( t 1 ) y ( t 2 ) . . . y ( t end ) (1) t 0 is the initial value of t , and t end is the final value of t . You need to specify

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}