Why do I get an error "Division by zero" when I switch to normal mode but No error by using accelerator mode?

14 Ansichten (letzte 30 Tage)
Hello,
I use a simulation model which contains a number of reference models and in order to speed up the performance I changed the simulation mode from Normal to Accelerator.
The simulation getting faster but recently I get on erro when I swicht back to Normal mode.
My question is:
Why do I get an error "Division by zero" when I switch to normal mode but No error by using accelerator mode?
Has anybody On Idea how to solve this Issue that I continue to use accelerator mode without having any software bug?
  4 Kommentare

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Pratheek
Pratheek am 1 Mär. 2023
Hi Noureddine Doumi,
When you change your simulation mode from Normal to Accelerator to speed up the simulation, the simulation behaves differently in Accelerator mode. While the simulation runs faster, certain errors, such as "Division by zero," may be masked or not triggered in the Accelerator mode. This can happen because the Accelerator mode optimizes the way calculations are performed differently than the Normal mode.
If you switch back to Normal mode and get an error, it may be because a variable or constant has a value of zero, which is causing a "Division by zero" error. To fix the error, you need to identify the variable or constant causing the error and adjust its value so that it is not zero. You can also modify your simulation code to handle the "Division by zero" case by checking for a zero value before performing the division operation.

Noureddine Doumi
Noureddine Doumi am 1 Mär. 2023
Hi Pratheek,
Thank you for your answer!
The errror will be found by testing the code using different scenarios.
Is it possible to identify the cause using accelerator mode?
How can I modify the simulation code to handle the "Division by zero" case by checking for a zero value before performing the division operation?

Kategorien

Mehr zu Manual Performance Optimization finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by