Main Content

Parameter Quantization Advisor

Inspect numerical issues related to parameter quantization

Since R2022b

Description

The Parameter Quantization Advisor app provides details on numerical issues related to parameter quantization. Using this app, you can:

  • Filter quantization issues resulting from parameter overflow, underflow, and precision loss.

  • Sort quantization issues based on bits of error, absolute error, or relative error.

  • Explore in detail the effects of parameter quantization on your model.

  • Explore all parameters in model that have quantization issues.

Screenshot of Parameter Quantization Advisor

Open the Parameter Quantization Advisor App

  • Diagnostic Viewer: From a numeric diagnostic warning or error, under Suggested Actions, click Open.

  • MATLAB® command prompt: Enter

    parameterQuantizationAdvisor('block_path','parameter_name')

Examples

expand all

Use the Parameter Quantization Advisor to explore parameter precision loss in a feedback controller model.

Open the fxpdemo_feedback model.

fxpdemo_feedback

Check that parameter diagnostics are enabled. In the Configuration Parameters dialog, under Diagnostics > Data Validity, set the Detect precision loss parameter diagnostic to warning.

Simulate the model.

The Diagnostic Viewer displays a warning for parameter precision loss.

parameter-quantization-advisor-warning-msg.png

To inspect details of this diagnostic in the Parameter Quantization Advisor, from Suggested Actions, click Open.

PQA.png

The app displays details of the parameter precision loss that occurred in fxpdemo_feedback/Denominator Terms. In this example, the model has only precision loss issues, as indicated by a blue square in the Quantization Issue column of the table. You can also use the app to explore overflow and underflow issues.

Four coefficients in the Discrete FIR Filter block named Denominator Terms experienced precision loss. The table shows the dialog value entered for each parameter and the corresponding quantized value of each parameter. You can sort the table by bits of error, absolute error, or relative error.

The Parameter Details pane contains additional details for the parameter experiencing numeric issues, including the location in the model and the name, dimension, and complexity of the parameter. The table displays the data type of the parameter in the dialog and the data type of the parameter at run time along with the minimum, maximum, and precision representable by these data types.

Tips

  • Update the diagram or simulate the model to view messages in the Diagnostic Viewer.

  • The model must successfully compile in order to launch the Parameter Quantization Advisor app. If a diagnostic errors, the model will not compile and the app cannot be launched.

  • The Parameter Quantization Advisor app reports information for these quantization issues:

    Diagnostics set to none are also reported in the app.

  • The Parameter Quantization Advisor reports details on quantization issues for tunable and nontunable parameters that experience quantization loss.

  • A hierarchical tree of parameters in the model that have quantization issues is displayed in the Parameter Explorer. You can enter a string to search for a particular element within this tree. Select the parameter you would like to inspect to view additional details.

Version History

Introduced in R2022b

expand all