function dxyzdt = lorenz_deriv ( t, xyz )

%*****************************************************************************80
%
%% lorenz_deriv() evaluates the right hand side of lorenz_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Edward Lorenz,
%    Deterministic nonperiodic flow,
%    Journal of Atmospheric Science,
%    Volume 20, Number 2, 1963, pages 130-141.
%
%    Stephen Lucas, Evelyn Sander, Laura Taalman,
%    Modeling dynamical systems for 3D printing,
%    Notices of the American Mathematical Society,
%    Volume 67, Number 11, December 2020, pages 1692-1705.
%
%  Input:
%
%    real t: the value of the independent variable.
%
%    real xyz: the values of the dependent variables at time T.
%
%  Output:
%
%    real dxyzdt: the right hand side of the ODE.
%
  [ beta, rho, sigma, t0, xyz0, tstop ] = lorenz_parameters ( );

  x = xyz(1);
  y = xyz(2);
  z = xyz(3);

  dxdt = sigma * ( y - x );
  dydt = x * ( rho - z ) - y;
  dzdt = x * y - beta * z;

  dxyzdt = [ dxdt; dydt; dzdt ];

  return
end

