function F=LorenzEq(t, XYZ, params);
%LorenzEq.m--ODEFUN implmenting Lorenz equations
%
%F=LorenzEq(t, XYZ, params);
%
%Implements the Lorenz equations.  The optional parameters
%are
%			params(1)=sigma--the Prandtl number
%              (2)=  r  --the Rayleigh number
%              (3)=  b  --aspect ratio
%
%If params is not provided, then it is set to
%params=[10 28 8/3];
%
if nargin<3;
	sig=10;
   r=28;
   b=8/3;
else
	sig=params(1);
   r=params(2);
   b=params(3);
end

F=zeros(3,1); %F must be a column vector

F(1)=sig*(XYZ(2)-XYZ(1));
F(2)=r*XYZ(1)-XYZ(2)-XYZ(1)*XYZ(3);
F(3)=XYZ(1)*XYZ(2)-b*XYZ(3);
