In models, data types determine the interactions between signals and block parameters. Numeric data types determine how a computer stores signals and parameters in memory and how a computer performs math operations.
To simulate the mathematical behavior of computer hardware, or to generate efficient code from a model, you can control the numeric data types of signals and parameters.
Describes how fixed-point numbers are represented in Simulink®.
Discusses the representation and manipulation of floating-point numbers
Data types supported for simulation and code generation
The dynamic range of fixed-point numbers is much less than floating-point numbers with equivalent word sizes. To avoid overflow conditions and minimize quantization errors, fixed-point numbers must be scaled.
The quantization of a real-world value is represented by a weighted sum of bits.
The range of a number gives the limits of the representation, while the precision gives the distance between successive numbers in the representation. The range and precision of a fixed-point number depend on the length of the word and the scaling.
Scaled doubles are a hybrid between floating-point and fixed-point numbers. The Fixed-Point Designer™ software stores them as doubles with the scaling, sign, and word length information retained.
Provides an example based on the
which highlights many of the key features of the Fixed-Point
How to avoid precision loss by overriding the data types in your model with scaled doubles.
The port display for fixed-point signals consists of three parts: the data type, the number of bits, and the scaling.