PDA

View Full Version : Matlab ODE problem


JohnSimpson
Oct3-09, 12:48 AM
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.

jamesrc
Oct3-09, 10:10 AM
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.

JohnSimpson
Oct3-09, 12:15 PM
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.

jamesrc
Oct3-09, 01:48 PM
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.