matlab中_ODE45的用法_英文资料

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Bucknell University Using ODE45MATLAB Help MATLAB's standard solver for ordinary differential equations (ODEs) is the function ode45. This function implements a Runge-Kutta method with a variable time step for efficient computation.ode45 id designed to handle the following general problem

d dt t t o o y f y y y ==(,)()[1]

where t is the independent variable (time, position, volume) and y is a vector of dependent variables (temperature, position, concentrations) to be found. The mathematical problem is specified when the vector of functions on the right-hand side of Eq. [1], f y (,)t , is set and the initial conditions, y =y o at time t o , are specified.

The notes here apply to versions of MATLAB above 5.0 and cover the basics of using the function ode45. For more information on this and other ODE solvers in MATLAB, see the on-line help.Contents:

Syntax for ode45 (2)

Integrating a single, first-order equation (3)

Getting the solution at particular values of the independent variable (4)

Integrating a set of coupled first-order equations (4)

Integrating a second-order initial-value problem (IVP) (7)

Integrating an N th-order initial-value problem (8)

Changing model parameters (9)

Integrating a second-order boundary-value problem (BVP)........................................................ 11Setting options in ode45.......................................................................................................... 12Going beyond ode45.. (13)

Syntax for ode45

ode45 may be invoked from the command line via

[t,y] = ode45('fname', tspan, y0, opts)

where

fname name of the function Mfile used to evaluate the right-hand-side function in Eq. [1] at

a given value of the independent variable and dependent variable(s) (string). The

function definition line usually has the form

function dydt = fname(t,y)

The output variable (dydt) must be a vector with the same size as y. Note that the

independent variable (t here) must be included in the input argument list even if it

does not explicitly appear in the expressions used to generate dydt.

tspan2-element vector defining the range of integration ([to tf]) though variations are possible.

y0vector of initial conditions for the dependent variable. There should be as many initial conditions as there are dependent variables.

opts a MATLAB structure variable that allows you to control the details of computation (if you want to). This argument is optional and, if not provided, ode45 will use

default values (see the examples below).

t Value of the independent variable at which the solution array (y) is calculated. Note that by default this will not be a uniformly distributed set of values.

y Values of the solution to the problem (array). Each column of y is a different dependent variable. The size of the array is length(t)-by-length(y0)

Specific examples of using ode45 now follow. Mfiles for these examples are in the body of this document and should also be available in the folder that contains this document.

相关文档
最新文档