Writing S-Functions    
mdlDerivatives

Compute the S-function's derivatives.

Syntax

Arguments

S
   SimStruct representing an S-Function block.

Description

Simulink invokes this optional method at each time step to compute the derivatives of the S-function's continuous states. This method should store the derivatives in the S-function's state derivatives vector. This method can use ssGetdX to get a pointer to the derivatives vector.

Each time the mdlDerivatives routine is called, it must explicitly set the values of all derivatives. The derivative vector does not maintain the values from the last call to this routine. The memory allocated to the derivative vector changes during execution.

Example

For an example, see matlabroot/simulink/src/csfunc.c.

Languages

Ada, C, M

See Also

ssGetdx


  mdlCheckParameters mdlGetTimeOfNextVarHit