HaoZ
HaoZ

Reputation: 39

Why ODE solver in MATLAB pop out out of memory, even the matrix is not large?

I try to solve a simulation problem based on ODE. But I get out of memory problem, could someone help me on this, a little bit hint?

Warning: Matrix is close to singular or badly scaled. Results may be

inaccurate. RCOND = 1.453788e-16. In ode23s at 207 In tr_ode at 77

Warning: Matrix is singular to working precision. In ode23s at 207 In tr_ode at 77

Out of memory. Type HELP MEMORY for your options.

Error in odenumjac (line 127) ydel = y(:,ones(1,ny)) + diag(del);

Error in ode23s (line 224) [dfdy,Joptions.fac,nF] = odenumjac(odeFcn, {t,y,odeArgs{:}}, f0, Joptions);

Error in tr_pdn_ode_matlab_v (line 77) [t,x] = ode23s(@f, [0,sim_param.end_time ], voltage, options);

The matrix is sparse and only 45784*45784

My machine is 64 bit and 12GB memory. MATLAB 2012b.

code snapshot:

...
options  = odeset('Mass', M); % M is a sparse matrix
[t,x] = ode45(@f, [0,end_time ], v, options); 
% end_time = 10^-8 , v is init. condition for f. 
... 
function out = f( t , y)
    out = -Gl *y ; % Gl is a sparse matrix
end

Upvotes: 1

Views: 800

Answers (1)

Mike Graham
Mike Graham

Reputation: 76753

That isn't a small matrix. If stored non-sparsely, it would be 16GB. ODENUMJAC should be implemented in such a way not to destroy your sparse storage, but it might be that some little bug somewhere tries to store it in full format. It might also be that it's stored right but just a lot bigger than you realize.

Upvotes: 0

Related Questions