You can use the Fixed-Point Tool to propose and apply fixed-point data types for commonly used System objects. The proposed data types are based on simulation data from the System objects.
Instrumentation and data type proposals are available for these DSP System Toolbox™ System objects:
The following limitations apply when working with System objects in the Fixed-Point Tool.
You cannot propose data types for these System objects based on static range data.
You must configure the System
object™ to use
The tool treats scaled doubles as fixed point. The scaled doubles workflow for System objects is the same as for regular variables.
The Fixed-Point Tool ignores the Default word length setting under Automatic data typing. Data type proposals are based on the settings of the System object.
This example converts a MATLAB® Function block that uses
object to fixed point
using the Fixed-Point Tool.
Open the folder where the model is located. At the MATLAB command line, enter:
ex_myFIRFilter.slx file to a writable
folder and open the model.
The MATLAB Function block contains a System object that filters a high-frequency sinusoid signal.
Right-click the MATLAB Function block and select Fixed-Point Tool.
In the Workflow pane, under System under
design, click Continue to select
Function as the system to convert.
In the Prepare System for Conversion section of
the toolstrip, under System under design, select
ex_myFIRFilter/MATLAB Function, which contains
the MATLAB Function block, as the system to convert.
In the Collect Ranges section of the toolstrip, select Simulation Ranges as the method of range collection. This button configures the model to collect ranges using idealized floating-point data types.
Click the Collect Ranges button arrow and select Use current settings to collect ranges without applying data type override to the model. Click the Collect Ranges button to start the simulation.
The Fixed-Point Tool stores the simulation data in a run titled
Run 1. Examine the range information of the
MATLAB variables in the spreadsheet.
Configure proposal settings and propose fixed-point data types for the model.
In the Convert Data Types section of the toolstrip, configure the data type proposal settings for the System object. In this example, use the default proposal settings to propose data types for the variables in the MATLAB Function block.
Click Propose Data Types. The data type proposals appear in the ProposedDT column of the spreadsheet.
The Fixed-Point Tool did not propose a data type for the
lowpassFIR.CustomProductDataType property. The
Fixed-Point Tool proposes data types only for fields of System objects
that are set to
To view more information about a proposal in the Result Details pane, select a result in the spreadsheet.
Click Apply Data Types. This action creates a variant subsystem that contains the original floating-point MATLAB Function block, and the automatically generated fixed-point MATLAB Function block.
The MATLAB Function block now uses the more precise fixed-point data types proposed by the Fixed-Point Tool.