daeFunction
Converts symbolic differential algebraic equations into a numeric residual function handle.
Category: Mathematics > Equation Solving
Syntax
f = daeFunction(eqs, vars)
Returns a handle f(t, y, yp) that evaluates the residual of every equation.
Description
Each residual is the left side minus the right side of an equation, with the symbolic functions replaced by entries of y and their derivatives by entries of yp. The handle is the form expected by ode15i and decic, which solve fully implicit systems F(t, y, y') = 0.
Input arguments
eqs- Vector of symbolic equations of a DAE system.
vars- Vector of the unknown symbolic functions, such as
[x(t) y(t)].
Output arguments
f- Function handle taking time
t, the state vectoryand its derivativeyp, and returning a column of residuals.
Example
Residual of a small DAE
syms x(t) y(t)
eqs = [diff(x,t) == y, x^2 + y^2 == 1];
f = daeFunction(eqs, [x y]);
f(0, [1; 0], [2; 0])
Output
ans = 2×1
2
0