- daeJacobianFunction : return a MATLAB function handle that returns the Jacobian matrices.
- isLowIndex : check if a DAE is of low index (0 or 1).
- orderMatrix : return the matrix storing differential orders of variables in DAE system.
- preprocessDAE : convert a DAE to another DAE to which
reduceIndexcan be applied. - reduceIndex : reduce the differential index of DAEs.
- systemJacobian : return the system Jacobian matrix of DAE system.
Jfun = daeJacobianFunction(eqs, vars)
Jfun = daeJacobianFunction(eqs, vars, p1, ..., pN)Jfun = daeJacobianFunction(eqs, vars)converts a symbolic first-order DAEeqsto a MATLAB function handleJfunthat returns a pair of Jacobian matrices evaluated at the given point(t, y0, yp0): the first one is the Jacobian ofeqsdifferentiated byvarsand the second one is that of bydiff(vars). The returned function handleJfunis acceptable as a value of thejacobianoption inodesetforode15i.Jfun = daeJacobianFunction(eqs, vars, p1, ..., pN)lets you specify the symbolic parameters of the system asp1, ...,pN.
syms x(t) y(t)
eqs = [x(t)*y(t), diff(x(t))+diff(y(t))];
vars = [x, y];
Jfun = daeJacobianFunction(eqs, vars)
[Jy, Jyp] = Jfun(0, [3; 4], [0; 0])Jfun = function_handle with value: @(t,in2,in3)deal(reshape([in2(2,:),0.0,in2(1,:),0.0],[2,2]),reshape([0.0,1.0,0.0,1.0],[2,2])) Jy = 4 2 0 0 Jyp = 0 0 1 1
syms x(t) y(t) a b
eqs = [a*x(t), a*b*diff(y(t))];
vars = [x, y];
Jfun = daeJacobianFunction(eqs, vars, a, b)
[Jy, Jyp] = Jfun(0, [2; 3], [4; 5], 6, 7) % a<-6, b<-7Jfun = function_handle with value: @(t,in2,in3,a,b)deal(reshape([a,0.0,0.0,0.0],[2,2]),reshape([0.0,0.0,0.0,a.*b],[2,2])) Jy = 6 0 0 0 Jyp = 0 0 0 42
tf = isLowIndex(eqs, vars)tf = isLowIndex(eqs, vars) returns true if a DAE eqs is of low differential index (0 or 1). This function can be applied to higher-order DAEs.
syms x(t) y(t)
eqs = [x(t)*y(t), diff(x(t))+diff(y(t))];
vars = [x, y];
isLowIndex(eqs, vars)ans = logical 1
syms x(t) y(t)
eqs = [diff(x(t),2)+y(t), diff(x(t),2)+x(t)+y(t)];
vars = [x, y];
isLowIndex(eqs, vars)ans = logical 0
S = orderMatrix(eqs, vars)S = orderMatrix(eqs, vars) returns a matrix whose (i, j)th entry contains the maximum k such that eqs(i) depends on the kth order time derivative of vars(j). If eqs(i) does not depend on any derivative of vars(j), the entry is set to -Inf.
syms x(t) y(t)
eqs = [x(t)*y(t), diff(x(t))+diff(y(t))];
vars = [x, y];
orderMatrix(eqs, vars)ans = 0 0 1 1
[newEqs, newVars] = preprocessDAE(eqs, vars)
[newEqs, newVars, degreeOfFreedom] = preprocessDAE(eqs, vars)
[newEqs, newVars, degreeOfFreedom, R] = preprocessDAE(eqs, vars, 'Method', 'augmentation')
[newEqs, newVars, degreeOfFreedom, R, constR] = preprocessDAE(eqs, vars, 'Method', 'augmentation', 'Constants', 'sym')[newEqs, newVars] = preprocessDAE(eqs, vars)converts a DAEeqsinto an equivalent DAEnewEqsto whichreduceIndexcan be applied.[newEqs, newVars, degreeOfFreedom] = preprocessDAE(eqs, vars)returns the degree of freedom of DAE's solutions, which is the dimension of the solution manifold.[newEqs, newVars, degreeOfFreedom, R] = preprocessDAE(eqs, vars, 'Method', 'augmentation')returns a matrixRthat expresses the new variables innewVarsas derivatives of the original variablesvars.[newEqs, newVars, degreeOfFreedom, R, constR] = preprocessDAE(eqs, vars, 'Method', 'augmentation', 'Constants', 'sym')returns a matrixconstRthat expresses the constants as derivatives of the original variablesvars.
| Option | Description | Possible Values |
|---|---|---|
Method |
Designate a modification method. The substitution method retains the size of the DAE system but is inapplicable to some DAEs. The augmentation method enlarges the system by introducing new variables and constants but is applicable to almost DAEs. The mixed-matrix method might run faster for large-scale DAEs but might return a DAE to which reduceIndex cannot be applied again with the input is highly nonlinear. |
substitution (default), augmentation, or mixedmatrix |
Constants |
Designate how constants introduced in the augmentation method should be treated. If Constants is zero, 0 is plugged in for all the constants. If Constants is sym, symbolic objects representing the constants are substituted. |
zero (default) or sym |
syms x(t) y(t)
vars = [x, y];
eqs = [
-diff(x(t), t, 2) - y(t) == sin(t)
diff(x(t), t, 2) + x(t) + y(t) == t
];
[newEqs, newVars, degreeOfFreedom] = preprocessDAE(eqs, vars)newEqs = x(t) - sin(t) - t x(t) - t + y(t) + diff(x(t), t, t) newVars = x(t) y(t) degreeOfFreedom = 0
syms x(t) y(t)
vars = [x, y];
eqs = [
-diff(x(t), t, 2) - y(t) == sin(t)
diff(x(t), t, 2) + x(t) + y(t) == t
];
[newEqs, newVars, degreeOfFreedom, R] = preprocessDAE(eqs, vars, 'Method', 'augmentation')newEqs = - Dxtt(t) - sin(t) x(t) - t + y(t) + diff(x(t), t, t) Dxtt(t) - t + x(t) newVars = x(t) y(t) Dxtt(t) degreeOfFreedom = 0 R = [ Dxtt(t), diff(x(t), t, t)]
syms x(t) y(t)
vars = [x, y];
eqs = [
-diff(x(t), t, 2) - y(t) == sin(t)
diff(x(t), t, 2) + x(t) + y(t) == t
];
[newEqs, newVars, degreeOfFreedom, R, constR] = preprocessDAE(eqs, vars, 'Method', 'augmentation', 'Constants', 'sym')newEqs = - consty - Dxtt(t) - sin(t) x(t) - t + y(t) + diff(x(t), t, t) consty - t + Dxtt(t) + x(t) newVars = x(t) y(t) Dxtt(t) degreeOfFreedom = 0 R = [ Dxtt(t), diff(x(t), t, t)] constR = [ consty, y(t)]
[newEqs, newVars] = reduceIndex(eqs, vars)
[newEqs, newVars, R] = reduceIndex(eqs, vars)[newEqs, newVars] = reduceIndex(eqs, vars)converts a DAEeqsto an equivalent DAEnewEqsof index at most 1 using the Mattsson−Söderlind method (MS-method). If a given DAE does not satisfy the validity condition of the MS-method, this function outputs an error. In this case, modify the DAE usingpreprocessDAEbeforehand. The functionreduceIndexcan be applied to higher-order DAEs.[newEqs, newVars, R] = reduceIndex(eqs, vars)returns a matrixRthat expresses the new variables innewVarsas derivatives of the original variablesvars.
syms y(t) z(t) T(t) g
eqs = [
diff(y(t), 2) == y(t)*T(t)
diff(z(t), 2) == z(t)*T(t) - g
y(t)^2 + z(t)^2 == 1
];
vars = [y, z, T];
[newEqs, newVars, R] = reduceIndex(eqs, vars)newEqs = Dytt(t) - T(t)*y(t) diff(z(t), t, t) + g - T(t)*z(t) y(t)^2 + z(t)^2 - 1 2*Dyt(t)*y(t) + 2*z(t)*diff(z(t), t) 2*Dytt(t)*y(t) + 2*Dyt(t)^2 + 2*diff(z(t), t)^2 + 2*z(t)*diff(z(t), t, t) newVars = y(t) z(t) T(t) Dyt(t) Dytt(t) R = [ Dyt(t), diff(y(t), t)] [ Dytt(t), diff(y(t), t, t)]
J = systemJacobian(eqs, vars)
[J, p, q] = systemJacobian(eqs, vars)J = systemJacobian(eqs, vars)returns the system Jacobian matrix of a DAEeqswith respect tovars. The(i, j)th entry of the resulting matrix is the derivative ofeqs(i)^(p(i))byvars(j)^(q(j)), wherepandqare a dual optimal solution of the assignment problem obtained from the order matrix of the DAE system (here,x^kmeans thekth-order time derivatived^k x(t)/dt^kofx(t)).reduceIndexcan be applied to a DAE system only if its system Jacobian is nonsingular.[J, p, q] = systemJacobian(eqs, vars)returns the values ofpandq.
syms x(t) y(t)
eqs = [x(t)*y(t), diff(x(t))+diff(y(t))];
vars = [x, y];
[J, p, q] = systemJacobian(eqs, vars)J = [ y(t), x(t)] [ 1, 1] p = 1 0 q = 1 1