Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Discrete Derivative

Compute discrete-time derivative

Library

Discrete

Description

The Discrete Derivative block computes an optionally scaled discrete time derivative as follows

where and are the block's input and output at the current time step, respectively, is the block's input at the previous time step, is a scaling factor, and is the simulation's discrete step size, which must be fixed.

Guidelines for Usage in Triggered Subsystems

When you use the Discrete Derivative block in triggered subsystems, follow these guidelines:

  • When the Sample time type parameter of the trigger port is triggered, verify that your model does not trigger the subsystem at the first time step.

    If your model triggers the subsystem at the first time step, the Discrete Derivative block generates a divide-by-zero warning message. This behavior occurs because the time step at t = 0 is zero.

  • When the Sample time type parameter of the trigger port is periodic, your model can trigger the subsystem at any time step.

Data Type Support

The Discrete Derivative block supports all numeric Simulink® data types, including fixed-point data types.

For more information, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

The Main pane of the Discrete Derivative block dialog box appears as follows:

Gain value

Scaling factor used to weight the block's input at the current time step.

Initial condition for previous weighted input K*u/Ts

Set the initial condition for the previous scaled input.

Input processing

Specify whether the block performs sample- or frame-based processing. You can select one of the following options:

  • Elements as channels (sample based) — Treat each element of the input as a separate channel (sample-based processing).

  • Columns as channels (frame based) — Treat each column of the input as a separate channel (frame-based processing).

      Note:   Frame-based processing requires a DSP System Toolbox™ license.

      For more information, see Sample- and Frame-Based Concepts in the DSP System Toolbox documentation.

  • Inherited — Inherit the processing mode from the input signal and delay the input accordingly. You can identify whether the input signal is sample or frame based by looking at the signal line. Simulink represents sample-based signals with a single line and frame-based signals with a double line.

      Note:   When you choose the Inherited option for the Input processing parameter, and the input signal is frame-based, Simulink will generate a warning or error in future releases.

Use Input processing to specify whether the block performs sample- or frame-based processing. The block accepts frame-based signals for the input u. All other input signals must be sample based.

Input Signal uInput Processing ModeBlock Works?
Sample basedSample basedYes
Frame basedNo, produces an error
Sample basedFrame basedYes
Frame basedYes
Sample basedInheritedYes
Frame basedYes

For more information about these two processing modes, see Sample- and Frame-Based Concepts in the DSP System Toolbox documentation.

The Signal Attributes pane of the Discrete Derivative block dialog box appears as follows:

Output minimum

Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges)

  • Automatic scaling of fixed-point data types

Output maximum

Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges)

  • Automatic scaling of fixed-point data types

Output data type

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via back propagation

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specify Block Output Data Types for more information.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Use Lock Output Data Type Setting.

Integer rounding mode

Specify the rounding mode for fixed-point operations. For more information, see Rounding. in the Fixed-Point Designer™ documentation.

Saturate to max or min when overflows occur

Select to have overflows saturate to the maximum or minimum value that the data type can represent. Otherwise, overflows wrap.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.

Characteristics

Direct Feedthrough

Yes

Scalar Expansion

Yes, of inputs and gain

See Also

Derivative

Was this topic helpful?