How to encounter a 1e-7 decimal place error when using single for calculations in Simulink?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I created a model in Simulink for testing the Simulink test tool. The division module was used in the model, and I found that the Divide module introduced calculation accuracy, which caused to fail the Simulink test. How can discard data with 1e-7 or other specified precision?
I already know that in Simulink test cases, error precision can be set to ignore calculation errors of specified precision. But if multiplication continues after the division module, the calculation error will accumulate and exceed the set error accuracy.
Looking forward to everyone's reply
2 Commenti
Risposte (1)
Suraj Kumar
il 27 Ago 2024
Based on my understanding, you are facing a precision issue due to a quantization error. To effectively manage this precision issue, you can apply a relative tolerance to your test case. This approach allows for small, acceptable deviations relative to the magnitude of the expected value, accommodating the quantization error.
To set the relative tolerance, you can navigate to ‘Baseline Criteria’ section in the test case editor where tolerance for signals are specified. Identify the signals for precision loss and set its ‘Relative Tolerance’ to 1% which allows the test to pass if the deviation is within 1% of the expected value.
You can refer to the output for better understanding:
For more details on “MATLAB Test Manager” please refer to the documentation linked below:
Hope this works for you!
Vedere anche
Categorie
Scopri di più su Outputs in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!