odeToVectorField
Reduce order of differential equations to first-order
Description
converts
higher-order differential equations V = odeToVectorField(eqn1,...,eqnN)eqn1,...,eqnN to
a system of first-order differential equations, returned as a symbolic
vector.
[ converts V,S] =
odeToVectorField(eqn1,...,eqnN)eqn1,...,eqnN and
returns two symbolic vectors. The first vector V is
the same as the output of the previous syntax. The second vector S shows
the substitutions made to obtain V.
Examples
Input Arguments
Output Arguments
Tips
To solve the resulting system of first-order differential equations, generate a MATLAB® function handle using
matlabFunctionwithVas an input. Then, use the generated MATLAB function handle as an input for the MATLAB numerical solverode23orode45.odeToVectorFieldcan convert only quasi-linear differential equations. That is, the highest-order derivatives must appear linearly. For example,odeToVectorFieldcan convert y*y″(t) = –t2 because it can be rewritten as y″(t) = –t2/y. However, it cannot convert y″(t)2 = –t2 or sin(y″(t)) = –t2.
Algorithms
To convert an nth-order differential equation
into a system of first-order differential equations, odetovectorfield makes
these substitutions.
Using the new variables, it rewrites the equation as a system of n first-order differential equations:
odeToVectorField returns the right sides
of these equations as the elements of vector V and
the substitutions made as the second output S.
Version History
Introduced in R2012aSee Also
dsolve | matlabFunction | odeFunction | ode23 | ode45
