Skip to Main Content Skip to Search
Product Documentation

Data Type Support

Supported Data Types

The API for user-written fixed-point S-functions provides support for a variety of Simulink and Simulink Fixed Point data types, including

For more information, see Fixed-Point Data Type and Scaling Notation.

The Treatment of Integers

The API treats integers as fixed-point numbers with trivial scaling. In [Slope Bias] representation, fixed-point numbers are represented as

real-world value = (slope  × integer) + bias.

In the trivial case, slope  =  1 and bias  =  0.

In terms of binary-point-only scaling, the binary point is to the right of the least significant bit for trivial scaling, meaning that the fraction length is zero:

real-world value = integer × 2-fraction length = integer ×  20.

In either case, trivial scaling means that the real-world value is equal to the stored integer value:

real-world value = integer.

All integers, including Simulink built-in integers such as uint8, are treated as fixed-point numbers with trivial scaling by this API. However, Simulink built-in integers are different in that their use does not cause a Simulink Fixed Point software license to be checked out.

Data Type Override

The Fixed-Point Tool enables you to perform various data type overrides on fixed-point signals in your simulations. This API can handle signals whose data types have been overridden in this way:

ScaledDouble signals are a hybrid between floating-point and fixed-point signals, in that they are stored as doubles with the scaling, sign, and word length information retained. The value is stored as a floating-point double, but as with a fixed-point number, the distinction between the stored integer value and the real-world value remains. The scaling information is applied to the stored integer double to obtain the real-world value. By storing the value in a double, overflow and precision issues are almost always eliminated. Refer to any individual API function reference page at the end of this appendix to learn how that function treats ScaledDouble signals.

For more information about the Fixed-Point Tool and data type override, refer to Fixed-Point Tool and the fxptdlg reference page in the Simulink documentation.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS