title: Vectorizing ODE in Octave / Matlab
body: <p>If I have an ode and wrote it in two ways, like here:</p>
  
  <pre><code>function re=rabdab()
  x=linspace(0,2000,2000)';
  tic;
  [T,Y] = ode45(@fun,[x],[0 1 1]);
  [T,Y] = ode45(@fun,[x],[0 1 1]);
  [T,Y] = ode45(@fun,[x],[0 1 1]);
  toc;
  
  tic;
  [A,B] = ode45(@fun2,[x],[0 1 1]);
  [A,B] = ode45(@fun2,[x],[0 1 1]);
  [A,B] = ode45(@fun2,[x],[0 1 1]);
  toc;
  
  
  
  function dy = fun(t,y)
  dy = zeros(3,1);    % a column vector
  dy = [y(2) * y(3);...
  -y(1) * y(3);...
  -0.51 * y(1) * y(2);];
  
  function dy = fun2(t,y)
  dy = zeros(3,1);    % a column vector
  dy(1) = y(2) * y(3);
  dy(2) = -y(1) * y(3);
  dy(3) = -0.51 * y(1) * y(2);
  </code></pre>
  
  <p>There is almost no difference in time. One takes just as long as the other. But I thought that <code>fun</code> is the vectorized version of <code>fun2</code>. Or am I mistaken here?
  The purpose is to speed up my code a little. The example is taken from the matlab webpage.
  I think I haven't really understood what "vectorized" means.
  If this is already vectorized, what would a non-vectorized code look like?</p>