Convert a semilinear system of differential algebraic equations to mass matrix form.
Create the following system of differential algebraic equations. Here, the functions x1(t)
and x2(t)
represent state variables of the system. The system also contains symbolic parameters r
and m
, and the function f(t,x1,x2)
. Specify the equations and variables as two symbolic vectors: equations as a vector of symbolic equations, and variables as a vector of symbolic function calls.
Find the mass matrix form of this system.
F =
Solve this system using the numerical solver ode15s
. Before you use ode15s
, assign the following values to symbolic parameters of the system: m = 100
, r = 1
, f(t,x1,x2) = t + x1*x2
. Also, replace the state variables x1(t)
, x2(t)
by variables Y1
, Y2
acceptable by matlabFunction
.
Create the following function handles MM
and FF
. You can use these function handles as input arguments for odeset
and ode15s
. These functions require state variables to be specified as column vectors.
Solve the system using ode15s
.
Copyright 2014 The MathWorks, Inc