Declare three output arguments when calling reduceRedundancies to simplify a system of equations and return information about the eliminated equations.
Create the following system of five differential algebraic equations (DAEs) in four state variables x1(t), x2(t), x3(t), and x4(t). The system also contains symbolic parameters a1, a2, a3, a4, b, c, and the function f(t) that are not state variables.
Call reduceRedundancies with three output arguments.
newEqs =
R = struct with fields:
solvedEquations: [2×1 sym]
constantVariables: [x4(t) f(t)]
replacedVariables: [x2(t) x1(t)/2]
otherEquations: f(t) - sin(t)
The function reduceRedundancies returns information about eliminated equations to R. Here, R is a structure array with four fields.
The solvedEquations field contains the equations that are eliminated by reduceRedundancies. The eliminated equations contain those state variables from vars that do not appear in newEqs. The right side of each eliminated equation is equal to zero.
R1 =
The constantVariables field contains a matrix with two columns. The first column contains those state variables from vars that reduceRedundancies replaced by constant values. The second column contains the corresponding constant values.
The replacedVariables field contains a matrix with two columns. The first column contains those state variables from vars that reduceRedundancies replaced by expressions in terms of other variables. The second column contains the corresponding values of the eliminated variables.
The otherEquations field contains those equations from eqs that do not contain any of the state variables vars.