reduceDifferentialOrder

Reduce system of higher-order differential equations to equivalent system of first-order differential equations

Description

example

[newEqs,newVars] = reduceDifferentialOrder(eqs,vars) rewrites a system of higher-order differential equations eqs as a system of first-order differential equations newEqs by substituting derivatives in eqs with new variables. Here, newVars consists of the original variables vars augmented with these new variables.

example

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

Examples

Reduce Differential Order of DAE System

Reduce a system containing higher-order DAEs to a system containing only first-order DAEs.

Create the system of differential equations, which includes a second-order expression. Here, x(t) and y(t) are the state variables of the system, and c1 and c2 are parameters. 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) c1 c2
eqs = [diff(x(t), t, t) + sin(x(t)) + y(t) == c1*cos(t),...
                              diff(y(t), t) == c2*x(t)];
vars = [x(t), y(t)];

Rewrite this system so that all equations become first-order differential equations. The reduceDifferentialOrder function replaces the higher-order DAE by first-order expressions by introducing the new variable Dxt(t). It also represents all equations as symbolic expressions.

[newEqs, newVars] = reduceDifferentialOrder(eqs, vars)
newEqs =
 diff(Dxt(t), t) + sin(x(t)) + y(t) - c1*cos(t)
                        diff(y(t), t) - c2*x(t)
                         Dxt(t) - diff(x(t), t)
 
newVars =
   x(t)
   y(t)
 Dxt(t)

Show Relations Between Generated and Original Variables

Reduce a system containing a second- and a third-order expression to a system containing only first-order DAEs. In addition, return a matrix that expresses the variables generated by reduceDifferentialOrder via the original variables of this system.

Create a system of differential equations, which includes a second- and a third-order expression. Here, x(t) and y(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 x(t) y(t) f(t)
eqs = [diff(x(t),t,t) == diff(f(t),t,t,t), diff(y(t),t,t,t) == diff(f(t),t,t)];
vars = [x(t), y(t)];

Call reduceDifferentialOrder with three output arguments. This syntax returns matrix R with two columns: the first column contains the new variables, and the second column expresses the new variables as derivatives of the original variables, x(t) and y(t).

[newEqs, newVars, R] = reduceDifferentialOrder(eqs, vars)
newEqs =
 diff(Dxt(t), t) - diff(f(t), t, t, t)
   diff(Dytt(t), t) - diff(f(t), t, t)
                Dxt(t) - diff(x(t), t)
                Dyt(t) - diff(y(t), t)
             Dytt(t) - diff(Dyt(t), t)
 
newVars =
    x(t)
    y(t)
  Dxt(t)
  Dyt(t)
 Dytt(t)
 
R =
[  Dxt(t),    diff(x(t), t)]
[  Dyt(t),    diff(y(t), t)]
[ Dytt(t), diff(y(t), t, t)]

Input Arguments

collapse all

System containing higher-order differential equations, specified as a vector of symbolic equations or expressions.

Variables of original differential equations, 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 differential equations, 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 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 newVars. The second column contains their definition as derivatives of the original variables vars.

Introduced in R2014b