% ode_1.m  using ode45 with setup
function ode_1
  options = odeset('RelTol', 1e-4, 'AbsTol', [1e-4 1e-4 1e-5]);
  [T,Y] = ode45(@ridgid, [0 12], [0 1 1], options);
  plot(T, Y(:,1), '-', T, Y(:,2), '-.', T, Y(:,3), '.')
  title('second order solution with ode45');
  xlabel('Time T');
  ylabel('Solution Y');
  legend('dy_1','dy_2','dy_3');

  function dy=ridgid(t, y)
   dy = zeros(3, 1);  % force a column vector
   dy(1) = y(2) * y(3);
   dy(2) = -y(1) * y(3);
   dy(3) = -0.51 * y(1) * y(2);
  end % ridgid
end % ode_1
