# reduceDifferentialOrder

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

## Syntax

## Description

`[`

rewrites
a system of higher-order differential equations `newEqs`

,`newVars`

]
= reduceDifferentialOrder(`eqs`

,`vars`

)`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.

## 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

## Output Arguments

## Version History

**Introduced in R2014b**