Unit Conversion

Convert units

  • Library:
  • Simulink / Signal Attributes

Description

The Unit Conversion block converts the unit of the input signal to the output signal. The block can perform the conversion if the units are separated by a scaling factor or offset, or are inverse units, for example:

  • y = a*U

  • y = a*U+b, where a is the scale and b is the offset

  • y = a/U

This block supports normal, accelerator, and rapid accelerator modes and fast restart.

Ports

Input

expand all

Input signal for unit conversion, specified as a scalar, vector, or matrix.

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

Output

expand all

Output signal with converted units, specified as a scalar, vector, or matrix.

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

Parameters

expand all

Specify the output data type.

  • Inherit: Inherit via internal rule — Simulink® chooses intermediate and output data types to balance numerical accuracy, performance, and generated code size, while accounting for the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change.

  • Inherit: Inherit via back propagation — Output data type is inherited via back propagation. Internal rules determine the intermediate data types and Simulink casts the final results to the output data type.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Inherit via internal rule' | 'Inherit via back propagation'
Default: 'Inherit via internal rule'

Block Characteristics

Data Types

double | fixed point | integer | single

Direct Feedthrough

yes

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Introduced in R2016a