a well-known problem: Out of Memory during the ode process!

4 views (last 30 days)
Hi everyone,
I'm trying to run a model using ode113 with 5252 state variables, the solver works pretty well in predefined time interval but at the end no result matrix can be generated. Until now I have tried to use @odeplot to plot just 2 of these 5252 variables which I need but I still facing the problem. I use a 64-bit Windows and MATLAB version running with 16 GB RAM. Any further suggestion?
  1 Comment
Steven Lord
Steven Lord on 29 Jun 2015
What's your tspan vector look like? If it's a vector with more than 2 elements, the ODE solver will try to return a length(tspan)-by-5252 matrix of values of the solution of your system of ODEs. Since you implied ODE113 throws an OOM error when it is trying to return, I suspect you have an extremely long tspan vector and allocating the output is what's running out of memory.

Sign in to comment.

Answers (1)

Jan
Jan on 29 Jun 2015
If the solver works successfully, post the code, which causes the error. We cannot guess the reason without seeing the code.
Beside this, the general rules can be recommended - search in the forum for "out of memory":
  • Install more RAM
  • Check your code for typos: rand(1e6) does not create a vector
  • Use a 64 bit Matlab and OS
  • Clear variables, which are not used anymore
  • Close other programs
  • Install more RAM
  • Prefer a a struct of arrays instead of an array of structs
  • Re-use arrays
  • Install more RAM
  • Use the smallest possible data type, e.g. uint8 instead of double.
  • Install more RAM

Community Treasure Hunt

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

Start Hunting!