Main Content

reduceDAEIndex

Convert system of first-order differential algebraic equations to equivalent system of differential index 1

Description

[newEqs,newVars] = reduceDAEIndex(eqs,vars) converts a high-index system of first-order differential algebraic equations eqs to an equivalent system newEqs of differential index 1.

reduceDAEIndex keeps the original equations and variables and introduces new variables and equations. After conversion, reduceDAEIndex checks the differential index of the new system by calling isLowIndexDAE. If the index of newEqs is 2 or higher, then reduceDAEIndex issues a warning.

example

[newEqs,newVars,R] = reduceDAEIndex(eqs,vars) returns matrix R that expresses the new variables in newVars as derivatives of the original variables vars.

example

[newEqs,newVars,R,oldIndex] = reduceDAEIndex(eqs,vars) returns the differential index, oldIndex, of the original system of DAEs, eqs.

example

Examples

Reduce Differential Index of DAE System

Check if the following DAE system has a low (0 or 1) or high (>1) differential index. If the index is higher than 1, then use reduceDAEIndex to reduce it.

Create the following system of two differential algebraic equations. Here, the symbolic functions x(t), y(t), and z(t) represent the state variables of the system. 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.

syms  x(t) y(t) z(t) f(t)
eqs = [diff(x) == x + z, diff(y) == f(t), x == y];
vars = [x(t), y(t), z(t)];

Use isLowIndexDAE to check the differential index of the system. For this system, isLowIndexDAE returns 0 (false). This means that the differential index of the system is 2 or higher.

isLowIndexDAE(eqs, vars)
ans =
  logical 
    0

Use reduceDAEIndex to rewrite the system so that the differential index is 1. The new system has one additional state variable, Dyt(t).

[newEqs, newVars] = reduceDAEIndex(eqs, vars)
newEqs =
 diff(x(t), t) - z(t) - x(t)
               Dyt(t) - f(t)
                 x(t) - y(t)
      diff(x(t), t) - Dyt(t)
 
newVars =
   x(t)
   y(t)
   z(t)
 Dyt(t)

Check if the differential order of the new system is lower than 2.

isLowIndexDAE(newEqs, newVars)
ans =
  logical
     1

Reduce the Index and Return More Details

Reduce the differential index of a system that contains two second-order differential algebraic equation. Because the equations are second-order equations, first use reduceDifferentialOrder to rewrite the system to a system of first-order DAEs.

Create the following system of two second-order DAEs. Here, x(t), y(t), and F(t) are the state variables of the system. 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.

syms t x(t) y(t) F(t) r g
eqs = [diff(x(t), t, t) == -F(t)*x(t),...
       diff(y(t), t, t) == -F(t)*y(t) - g,...
       x(t)^2 + y(t)^2 == r^2 ];
vars = [x(t), y(t), F(t)];

Rewrite this system so that all equations become first-order differential equations. The reduceDifferentialOrder function replaces the second-order DAE by two first-order expressions by introducing the new variables Dxt(t) and Dyt(t). It also replaces the first-order equations by symbolic expressions.

[eqs, vars] = reduceDifferentialOrder(eqs, vars)
eqs =
     diff(Dxt(t), t) + F(t)*x(t)
 diff(Dyt(t), t) + g + F(t)*y(t)
         - r^2 + x(t)^2 + y(t)^2
          Dxt(t) - diff(x(t), t)
          Dyt(t) - diff(y(t), t)
 
vars =
   x(t)
   y(t)
   F(t)
 Dxt(t)
 Dyt(t)

Use reduceDAEIndex to rewrite the system so that the differential index is 1.

[eqs, vars, R, originalIndex] = reduceDAEIndex(eqs, vars)
eqs =
                                                   Dxtt(t) + F(t)*x(t)
                                               g + Dytt(t) + F(t)*y(t)
                                               - r^2 + x(t)^2 + y(t)^2
                                                      Dxt(t) - Dxt1(t)
                                                      Dyt(t) - Dyt1(t)
                                       2*Dxt1(t)*x(t) + 2*Dyt1(t)*y(t)
 2*Dxt1t(t)*x(t) + 2*Dxt1(t)^2 + 2*Dyt1(t)^2 + 2*y(t)*diff(Dyt1(t), t)
                                                    Dxtt(t) - Dxt1t(t)
                                            Dytt(t) - diff(Dyt1(t), t)
                                               Dyt1(t) - diff(y(t), t)

vars =
     x(t)
     y(t)
     F(t)
   Dxt(t)
   Dyt(t)
  Dytt(t)
  Dxtt(t)
  Dxt1(t)
  Dyt1(t)
 Dxt1t(t)

R =
[  Dytt(t),  diff(Dyt(t), t)]
[  Dxtt(t),  diff(Dxt(t), t)]
[  Dxt1(t),    diff(x(t), t)]
[  Dyt1(t),    diff(y(t), t)]
[ Dxt1t(t), diff(x(t), t, t)]

originalIndex =
     3

Use reduceRedundancies to shorten the system.

[eqs, vars] = reduceRedundancies(eqs, vars)
eqs =
                                       Dxtt(t) + F(t)*x(t)
                                   g + Dytt(t) + F(t)*y(t)
                                   - r^2 + x(t)^2 + y(t)^2
                             2*Dxt(t)*x(t) + 2*Dyt(t)*y(t)
 2*Dxtt(t)*x(t) + 2*Dytt(t)*y(t) + 2*Dxt(t)^2 + 2*Dyt(t)^2
                                 Dytt(t) - diff(Dyt(t), t)
                                    Dyt(t) - diff(y(t), t)

vars =
    x(t)
    y(t)
    F(t)
  Dxt(t)
  Dyt(t)
 Dytt(t)
 Dxtt(t)

Input Arguments

collapse all

System of first-order DAEs, specified as a vector of symbolic equations or expressions.

State variables, specified as a vector of symbolic functions or function calls, such as x(t).

Example: [x(t),y(t)]

Output Arguments

collapse all

System of first-order DAEs of differential index 1, returned as a column vector of symbolic expressions.

Extended set of variables, returned as a column vector of symbolic function calls. This vector includes the original state variables vars followed by the generated variables that replace the second- and higher-order derivatives in eqs.

Relations between new and original variables, returned as a symbolic matrix with two columns. The first column contains the new variables. The second column contains their definitions as derivatives of the original variables vars.

Differential index of original DAE system, returned as an integer or NaN.

Algorithms

The implementation of reduceDAEIndex uses the Pantelides algorithm. This algorithm reduces higher-index systems to lower-index systems by selectively adding differentiated forms of the original equations. The Pantelides algorithm can underestimate the differential index of a new system, and therefore, can fail to reduce the differential index to 1. In this case, reduceDAEIndex issues a warning and, for the syntax with four output arguments, returns the value of oldIndex as NaN. The reduceDAEToODE function uses more reliable, but slower Gaussian elimination. Note that reduceDAEToODE requires the DAE system to be semilinear.

Version History

Introduced in R2014b