MATLAB Examples

Run Design Error Detection Analysis to Detect Floating-Point Errors

This example shows how to detect nonfinite, NaN, and subnormal floating-point values in the sldvexFloatingPointErrorChecks example model. The model consists of floating-point arithmetic operations that result in an error. Perform design error detection analysis to detect these errors in the model.

Contents

1. Open the Model

This example model consists of Add and Divide blocks that handle floating-point calculations. The design error detection analysis detects the occurrences of floating-point errors in the model and reports the results.

open_system('sldvexFloatingPointErrorChecks');

2. Perform Design Error Detection Analysis

The model is preconfigured with Non-finite and NaN floating-point values and Subnormal floating-point values options set to On. For more information see docid:sldv_ug#bssbb7e-1.

To perform design error detection analysis, in the Simulink editor, select Analysis > Design Verifier > Detect Design Errors.

The software analyzes the model for floating-point errors and displays the results in the Results Summary window. The result indicates that 4 out of 6 objectives are falsified.

3. Review Analysis Results

a. Click Highlight analysis results on model. The model blocks that result in floating-point errors are highlighted in red.

b. Click the Add block highlighted in red. The Result Inspector displays the summary of the floating-point error objectives.

c. Click the Division block highlighted in red. The Result Inspector displays the summary of the floating-point error objectives.

4. View Detailed Analysis Report

To view the detailed analysis report, in the Results Summary window, click HTML. The report displays the summary of all occurrences of floating-point errors in the model.

5. Clean Up

To complete this example, close the model.

close_system('sldvexFloatingPointErrorChecks', 0);