Main Content

reduceDAEIndex

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

Description

example

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

reduceDAEIndexkeeps the original equations and variables and introduces new variables and equations. After conversion,reduceDAEIndexchecks the differential index of the new system by callingisLowIndexDAE. If the index ofnewEqsis 2 or higher, thenreduceDAEIndexissues a warning.

example

[newEqs,newVars,R] = reduceDAEIndex(eqs,vars)returns matrixRthat expresses the new variables innewVarsas derivatives of the original variablesvars.

example

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

Examples

Reduce Differential Index of DAE System

Check if the following DAE system has a low (0or1) or high (>1) differential index. If the index is higher than1, then usereduceDAEIndex减少它。

Create the following system of two differential algebraic equations. Here, the symbolic functionsx(t),y(t), andz(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)];

UseisLowIndexDAEto check the differential index of the system. For this system,isLowIndexDAEreturns0(false). This means that the differential index of the system is2或更高版本。

isLowIndexDAE(eqs, vars)
ans = logical 0

UsereduceDAEIndexto rewrite the system so that the differential index is1. 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 than2.

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 usereduceDifferentialOrderto rewrite the system to a system of first-order DAEs.

Create the following system of two second-order DAEs. Here,x(t),y(t), andF(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. ThereduceDifferentialOrderfunction replaces the second-order DAE by two first-order expressions by introducing the new variablesDxt(t)andDyt(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)

UsereduceDAEIndexto rewrite the system so that the differential index is1.

[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

UsereduceRedundanciesto 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 asx(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 variablesvarsfollowed by the generated variables that replace the second- and higher-order derivatives ineqs.

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 variablesvars.

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

Algorithms

The implementation ofreduceDAEIndexuses 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 to1. In this case,reduceDAEIndexissues a warning and, for the syntax with four output arguments, returns the value ofoldIndexasNaN. ThereduceDAEToODEfunction uses more reliable, but slower Gaussian elimination. Note thatreduceDAEToODErequires the DAE system to be semilinear.

更小ion History

Introduced in R2014b