MATLAB Optimizing Matlab ODE15s for Coupled ODEs

  • Thread starter Thread starter JohnSimpson
  • Start date Start date
  • Tags Tags
    Matlab Ode
AI Thread Summary
The discussion centers on optimizing the performance of Matlab's ODE15s solver when working with 40 coupled ordinary differential equations (ODEs) over the interval from 0 to 0.01. The user reports that the solver is taking an excessive 40 minutes to compute solutions at over a million points, which is more precision than desired. Suggestions include specifying a custom time vector for the tspan argument to limit the output points, but it is noted that this does not reduce computation time since ODE15s still calculates intermediate points. Another recommendation is to adjust the solver's tolerance settings by relaxing the default Relative Tolerance (RelTol) and Absolute Tolerance (AbsTol), which may help decrease the number of calculated points and reduce computation time. However, it is acknowledged that the inherent complexity of the system may limit further optimization.
JohnSimpson
Messages
89
Reaction score
0
I've been doing some work with coupled ODEs in Matlab. I've been using ODE15s, and calculating the solutions of 40 coupled equations between t=0...0.01, but Matlab seems to be calculating far more accurately than I want, it's taking 40 minutes to produce a solution and determining the function at over a million points on the domain.

Any suggestions on how to make things a little less precise? If I only had one of every thousand of the points it calculates, I'd be happy.
 
Physics news on Phys.org
You can specify the points for which the solution is found if you give a vector for the tspan argument. So, if you're saying that it's calculating for too many points when you use t = [0 .01], then you can just specify t = (0:.001:.01) or whatever values it is that you want there. I hope that helps.
 
Thanks james. the problem with that is that odeXX continues to calculate the intermediate points regardless, and at the end just spits out the points you requested. So the computation time is exactly the same.
 
Oh - sorry about that. Have you tried playing with the tolerance? If you relax the default settings on RelTol and AbsTol, maybe it won't require such a small step size.

Other than that I'm not really sure - that might just be the best you can do with the complexity of your system.
 
Last edited:
Back
Top