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

13 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

回答(2 个)

Pratheek
Pratheek 2023-3-1
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 2023-3-1
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?

类别

Help CenterFile Exchange 中查找有关 Manual Performance Optimization 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by