Error occurring while solving odes using ode15s
Show older comments
Hello,
I am trying to solve a systems of nonlinear ODE using ODE15s but I keep getting an error after about 29 seconds and I can't figure out what is causing the error.
see a screen shot of the error.
What could be the likely cause of this error.

10 Comments
Walter Roberson
on 1 Aug 2021
Did you configure a sparse mass matrix? And does your ode routine return a single precision vector?
Telema Harry
on 1 Aug 2021
Edited: Telema Harry
on 2 Aug 2021
Walter Roberson
on 1 Aug 2021
Are you able to post your code for testing?
Telema Harry
on 2 Aug 2021
Walter Roberson
on 2 Aug 2021
When you invoke your ode function passing in your initial time and your initial conditions, what is class() of the result?
Also, have you configured Mass Matrix? Have you configured any special functions such as for estimation of the gradient? Is it possible that you passed in your time as single precision, or your boundary conditions as single precision?
That particular section of code, you could potentially get that error depending upon what a Mass Matrix function returned, I suspect.
Telema Harry
on 2 Aug 2021
Edited: Telema Harry
on 2 Aug 2021
Walter Roberson
on 2 Aug 2021
Put a breakpoint at the call to ode45. Run until there. Then command
class(tspan)
class(In0)
class(wind)
class(I)
class(B)
class(DATE)
test_output = dynamics(tspan(1), In0, wind)
class(test_output)
and tell us what results show up.
Walter Roberson
on 2 Aug 2021
By the way, it is recommended that you get rid of your global variables, and that you do not use that form of ode*() call to pass extra variables. That method of passing extra variables has not been documented for over 15 years, and there are cases where it will pass the wrong information (it is incompatible with some of the newer documented options, and the documented options have priority.)
Telema Harry
on 3 Aug 2021
Telema Harry
on 3 Aug 2021
Answers (1)
Sulaymon Eshkabilov
on 1 Aug 2021
Edited: Sulaymon Eshkabilov
on 1 Aug 2021
0 votes
The computed solution might be "nan" or "inf" only. Briefly speaking the size mismatch.
2 Comments
Walter Roberson
on 1 Aug 2021
I do not understand how this could explain the error message about trying to mix sparse and single in a * operation ?
Telema Harry
on 2 Aug 2021
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
