error in ode45 command

2 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2022-8-11

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 个评论
ali ziaei
ali ziaei 2022-8-13
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 2022-8-13
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 = 

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by