`tout = [0,2]; %%%output times`

u0 = [30;1;30]; %%%initial data

M=zeros(10,3);N=zeros(9,3);y=zeros(9,1);x=zeros(9,1);for i=1:10n=2^i; %%% the number of equal sized steps

tic %%%start timer

[t,u] = oderk4(@chemcon,tout,u0,n); %%%run the solver

t2=toc; %%%stop timer

M(i,:)=u(end,:);end

oderk4 is a function for solving ode, and the output of oderk4 are a vector t and a matrix u. I want to use the last row of every matrix u, so I let M to represent them. However, M doesn't have value after the loop. The workspace shows M is NaN. What's wrong with it?

## Best Answer