Optimizing Matlab ODE15s for Coupled ODEs

  • Context: MATLAB 
  • Thread starter Thread starter JohnSimpson
  • Start date Start date
  • Tags Tags
    Matlab Ode
Click For Summary

Discussion Overview

The discussion focuses on optimizing the performance of Matlab's ODE15s solver for coupled ordinary differential equations (ODEs). Participants explore ways to reduce computation time and adjust the precision of the solution over a specified time domain.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant reports long computation times (40 minutes) when solving 40 coupled ODEs and seeks ways to reduce precision to speed up the process.
  • Another participant suggests specifying the time points using a vector for the tspan argument to limit the output points, but acknowledges that this does not reduce computation time.
  • A third participant proposes adjusting the tolerance settings (RelTol and AbsTol) to potentially allow for larger step sizes, which might decrease computation time.
  • There is uncertainty about whether further optimization is possible given the complexity of the system being modeled.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best method to reduce computation time, as suggestions vary and the effectiveness of proposed adjustments remains uncertain.

Contextual Notes

Limitations include the dependence on the specific characteristics of the coupled ODE system and the potential impact of tolerance settings on solution accuracy.

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:

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
Replies
5
Views
9K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 5 ·
Replies
5
Views
10K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
6
Views
2K
Replies
5
Views
12K
  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 1 ·
Replies
1
Views
3K