error in ode45 command

1 Ansicht (letzte 30 Tage)
ali ziaei
ali ziaei am 11 Aug. 2022
Kommentiert: Walter Roberson am 13 Aug. 2022
I wrote a program containing 40 differential equations and after running the program with ode 45 command, I encountered the following message.
"Warning: Failure at t=7.384867e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t."
i can't understand it and need urgent help.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Aug. 2022

You could experiment with ode23s but it will probably lead to the same result.

You have a singularity in your equations when calculated from that starting point.

  • you might have implemented the equations incorrectly
  • the equations might be unstable together
  • a different starting point might be necessary
  • the equations might not be differentiable. For example you might have "if" in them or linear interpolation

I recommend setting up plotting of the components using the PlotFcn option so that you can get a better idea of how the components are behaving.

  4 Kommentare
ali ziaei
ali ziaei am 13 Aug. 2022
Hello Mr Walter Roberson.
I asked a question that you answered. Thank you very much.
The truth is that I have been stuck in these equations for a long time and I really don't know what to do. Thank you for helping me.
Walter Roberson
Walter Roberson am 13 Aug. 2022
The next step is to use the Symbolic Toolbox to build the system of equations, and then follow the steps shown in odeFunction()
When you try to build a system with 40 equations, it is quite difficult to visualize whether you have created corect code. It is much easier to examine symbolic formulas. Especially if you use LiveScript and code to add subscripts and accents; see https://www.mathworks.com/help/symbolic/add-suffixes-to-symbolic-results.html
For example this is probably easier to read than the code for setting up numerically directly
syms theta(t) phi(t)
theta__dot = diff(theta,t);
phi__dot = diff(phi(t));
eqn1 = theta__dot == phi
eqn1(t) = 
eqn2 = phi__dot == phi - theta
eqn2(t) = 
eqns = [eqn1, eqn2]
eqns(t) = 
sol = dsolve(eqns);
simplify(sol.phi)
ans = 
simplify(sol.theta)
ans = 

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by