Documentation

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Rounding Function

Apply rounding function to signal

Library

Math Operations

Description

The Rounding Function block applies a rounding function to the input signal to produce the output signal.

You can select one of the following rounding functions from the Function list:

  • floor

    Rounds each element of the input signal to the nearest integer value towards minus infinity.

  • ceil

    Rounds each element of the input signal to the nearest integer towards positive infinity.

  • round

    Rounds each element of the input signal to the nearest integer.

  • fix

    Rounds each element of the input signal to the nearest integer towards zero.

The name of the selected function appears on the block.

The input signal can be a scalar, vector, or matrix signal having real- or complex-valued elements of type double. The output signal has the same dimensions, data type, and numeric type as the input. Each element of the output signal is the result of applying the selected rounding function to the corresponding element of the input signal.

    Tip   Use the Rounding Function block instead of the Fcn block when you want vector or matrix output, because the Fcn block produces only scalar output.

    Also, the Rounding Function block provides two more rounding modes. The Fcn block supports floor and ceil, but does not support round and fix.

Data Type Support

The Rounding Function block accepts and outputs real signals of type double or single.

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

Parameters

Function

Specify the rounding function.

Sample time

Characteristics

Data Types

Double | Single

Sample Time

Inherited from driving block

Direct Feedthrough

Yes

Multidimensional Signals

No

Variable-Size Signals

No

Zero-Crossing Detection

No

Code Generation

Yes

Introduced before R2006a

Was this topic helpful?