function f = lorenz2(t,x,sigma,rho,beta)
%
% Calculates the right-hand-side for a system of 
% 3 ODEs (Lorenz equations):
%    dxdt = sigma(y-x)
%    dydt = -xz+rho*x-y
%    dzdt = xy-beta*z
%
% input:
%    t: time
%    x(1:3) : 3-element vector representing (x,y,z)
%    sigma  : parameter value
%    rho    : parameter value
%    beta   : parameter value
% output:
%    f(1:3) : 3-element vector of rhs
%
f=zeros(3,1);
f(1) = sigma*(x(2)-x(1));
f(2) = -x(1)*x(3)+rho*x(1)-x(2);
f(3) = x(1)*x(2)-beta*x(3);