Return time derivative of operand

`der(x)`

x.der

The `equations`

section may contain `der`

operator,
which returns the time derivative of its operand:

`der(x)`

= `x.der`

= $$\dot{x}$$= $$\frac{dx}{dt}$$

`der`

operator takes any numerical expression
as its argument:

`der`

applied to expressions that are continuous returns their time derivative`der`

applied to`time`

argument returns 1`der`

applied to expressions that are parametric or constant returns 0`der`

applied to countable operands returns 0. For example,`der(a<b)`

returns 0 even ifand`a`

are variables.`b`

The return unit of `der`

is the unit of its
operand divided by seconds.

The following restrictions apply:

You cannot form nonlinear expressions of the output from

`der`

. For example,`der(x)*der(x)`

would produce an error because this is no longer a linearly implicit system.Higher order derivatives are not allowed. For example,

`der(der(x))`

would produce an error.For a component to compile, the number of differential equations should equal the number of differential variables.

This example shows implementation for a simple dynamic system:

$$\dot{x}=1-x$$

The Simscape™ file looks as follows:

component MyDynamicSystem variables x = 0; end equations x.der == (1 - x)*{ 1, '1/s' }; % x' = 1 - x end end

The reason you need to multiply by `{ 1, '1/s' }`

is
that `(1-x)`

is unitless, while the left-hand side
(`x.der`

) has the units of 1/s. Both sides of the
equation statement must have the same units.

Was this topic helpful?