Documentation

Discrete Derivative

Compute discrete-time derivative

  • Library:
  • Simulink / Discrete

Description

TheDiscrete Derivativeblock computes an optionally scaled discrete time derivative as follows

y ( t n ) = K u ( t n ) T s K u ( t n 1 ) T s

where

  • u ( t n ) and y ( t n ) are the block's input and output at the current time step, respectively.

  • u ( t n 1 ) is the block's input at the previous time step.

  • K is a scaling factor.

  • T s is the simulation's discrete step size, which must be fixed.

Note

Do not use this block in subsystems with a nonperiodic trigger (for example, nonperiodic function-call subsystems). This configuration produces inaccurate results.

Ports

Input

expand all

Input signal, specified as a scalar, vector, or matrix.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|fixed point

Output

expand all

Optionally scaled discrete-time derivative, specified as a scalar, vector, or matrix. For more information on how the block computes the discrete-time derivative, seeDescription. You specify the data type of the output signal with theOutput data typeparameter.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|fixed point

Parameters

expand all

Main

Scaling factor used to weight the block's input at the current time step, specified as a real-valued scalar.

Programmatic Use

Block Parameter:gainval
Type:character vector
Values:scalar
Default:'1.0'

Initial condition for the previous scaled input, specified as a scalar.

Programmatic Use

Block Parameter:ICPrevScaledInput
Type:character vector
Values:scalar
Default:'0.0'

Specify whether the block performs sample- or frame-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, seeSample- and Frame-Based Concepts(DSP System Toolbox).

  • Elements as channels (sample based)-对每个元素的输入作为一个单独的channel (sample-based processing).

  • 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 theInheritedoption for theInput processingparameter, and the input signal is frame based, Simulink generates a warning or error in future releases.

UseInput processingto specify whether the block performs sample- or frame-based processing. The block accepts frame-based signals for the inputu. All other input signals must be sample based.

Input Signal u Input Processing Mode Block Works?
Sample based Sample based Yes
Frame based No, produces an error
Sample based Frame based Yes
Frame based Yes
Sample based Inherited Yes
Frame based Yes

For more information about these two processing modes, seeSample- and Frame-Based Concepts(DSP System Toolbox).

Programmatic Use

Block Parameter:InputProcessing
Type: character vector
Values:'Columns as channels (frame based)'|'Elements as channels (sample based)'|'Inherited'
Default:'Elements as channels (sample based)'

Signal Attributes

Lower value of the output range that Simulink checks.

Simulink uses the minimum to perform:

Note

Output minimumdoes not saturate or clip the actual output signal. Use theSaturationblock instead.

Programmatic Use

Block Parameter:OutMin
Type: character vector
Values:'[ ]'| scalar
Default:'[ ]'

Upper value of the output range that Simulink checks.

Simulink uses the maximum value to perform:

Note

Output maximumdoes not saturate or clip the actual output signal. Use theSaturationblock instead.

Programmatic Use

Block Parameter:OutMax
Type: character vector
Values:'[ ]'| scalar
Default:'[ ]'

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

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

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

  • The name of a data type object, for example, aSimulink.NumericTypeobject

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

Click theShow data type assistantbuttonto display theData Type Assistant, which helps you set the data type attributes. SeeSpecify Data Types Using Data Type Assistantfor more information.

Programmatic Use

Block Parameter:OutDataTypeStr
Type:character vector
Values:'Inherit: Inherit via internal rule' | 'Inherit: Inherit via back propagation' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'
Default:'Inherit: Inherit via internal rule'

Select this parameter to prevent the fixed-point tools from overriding theOutputdata type you specify on the block. For more information, seeUse Lock Output Data Type Setting(Fixed-Point Designer).

Programmatic Use

Block Parameter:LockScale
Type:character vector
Values:'off' | 'on'
Default:'off'

For more information, seeRounding(Fixed-Point Designer).

Block parameters always round to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB®rounding function into the mask field.

Programmatic Use

Block Parameter:RndMeth
Type:character vector
Values:'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero'
Default:'Floor'

When you select this check box, 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.

Programmatic Use

Block Parameter:DoSatur
Type:character vector
Values:'off' | 'on'
Default:'off'

Block Characteristics

Data Types

double|single|base integer|fixed point

Multidimensional Signals

No

Variable-Size Signals

Yes

Extended Capabilities

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.

Introduced before R2006a

Was this topic helpful?