error in ode45 command

4 views (last 30 days)
ali ziaei
ali ziaei on 11 Aug 2022
Commented: Walter Roberson on 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.

Accepted Answer

Walter Roberson
Walter Roberson on 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 Comments
Walter Roberson
Walter Roberson on 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 = 

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!