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