Represent signals and parameter values with fixed-point
numbers to improve performance of generated code

Within digital hardware, numbers are represented as either fixed-point or floating-point data types. For both of these data types, word sizes are fixed at a set number of bits. However, the dynamic range of fixed-point values is much less than floating-point values with equivalent word sizes. While floating-point processors can greatly simplify the real-time implementation of a system, and effectively approximate real-world numbers, fixed-point processors carry numerous other benefits. Fixed-point processors are generally smaller, consuming less power. They also require less memory and less processor time to perform.

To simulate a model that uses fixed-point numbers, you must install the Fixed-Point Designer™ product. You do not need the Fixed-Point Designer product to edit a model containing fixed-point blocks, or to specify fixed-point data types.

`fxptdlg` |
Start Fixed-Point Tool |

`fixdt` |
Create Simulink.NumericType object describing fixed-point or floating-point data type |

`fixpt_look1_func_approx` |
Optimize fixed-point approximation of nonlinear function by interpolating lookup table data points |

`fixpt_evenspace_cleanup` |
Modify breakpoints of lookup table to have even spacing |

`fixpt_interp1` |
Implement 1-D lookup table |

`fixpt_look1_func_plot` |
Plot fixed-point approximation function for lookup table |

`fixpt_set_all` |
Set property for each fixed-point block in subsystem |

`fixptbestexp` |
Exponent that gives best precision for fixed-point representation of value |

`fixptbestprec` |
Determine maximum precision available for fixed-point representation of value |

`float` |
Create Simulink.NumericType object describing floating-point data type |

`num2fixpt` |
Convert number to nearest value representable by specified fixed-point data type |

`sfix` |
Create Simulink.NumericType object describing signed fixed-point data type |

**Specify Fixed-Point Data Types**

If you do not have Fixed-Point Designer, you can still inspect and use fixed-point models that others share with you.

**Specify Data Types Using Data Type Assistant**

Interactively apply data types, such as integer, fixed-point, and enumerated types, to data items in a model.

Inspect and use an existing fixed-point model when you do not have Fixed-Point Designer.

**Control Fixed-Point Instrumentation and Data Type Override**

If you do not have Fixed-Point Designer, you can
work with a model containing Simulink^{®} blocks with fixed-point
settings by turning off fixed-point instrumentation and setting data
type override to scaled doubles.

In computer memory, an item of fixed-point data is stored as an integer. To interpret the data as a real-world number, the computer applies a mathematical scaling to the integer. The scaling is fixed, which means it cannot change during execution.

**Benefits of Using Fixed-Point Hardware**

Fixed-point designs can perform faster and consume fewer computing resources than floating-point designs.

Examine the interaction between the scaling that you apply to fixed-point data, the precision with which the data can represent real-world values, and the range of real-world values that the data can represent.

**Fixed-Point Data in MATLAB and Simulink**

Apply fixed-point data types to data in Simulink models
and to data in MATLAB^{®} code.

Was this topic helpful?