Problem in matlab code run error.

조회 수: 11 (최근 30일)
Muhammad Asad
Muhammad Asad 2023년 1월 2일
답변: Sudarshan 2023년 1월 5일
Dear community I try to run a code but i recieved an error. screen shot of both error and matlab coding attached. I try very hard to resolve but still get no successs.
My complex model run properly. But when i add two integrals for calculations of error then my model give these error messages.
By default min step size in solver is auto. After receiving error i changed it to a value shown below in attached fig.
Your resposne will be highly appreciated.

답변 (1개)

Sudarshan
Sudarshan 2023년 1월 5일
Hello Muhammad Asad,
The error message that you have shared indicates that one of the signals in your model is diverging to plus or minus infinity. It could be possible that a signal is changing too rapidly based on the solver settings.
This basically means that the solver is unstable for the equations represented by the model. I believe that it could be a stiff model that requires more stability for the solver.
A quick fix would be to select your solver as “ode45” and see if it works.
You can also refer to the documentation below to find out the correct solver for your model based on the requirements:
Another suggested way is to reduce the maximum order of the model as suggested in the documentation below:
Hope it helps!!

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by