function y=f(x)

%--------------------
% Anilin+     -> x(1)
% H           -> x(2)
% Anilin(aq)  -> x(3)
% Anilin(okt) -> x(4)
%--------------------

global pH AnilinOKT

KA  = 10^-4.63;
Kow = 7.9;

y = zeros(size(x));

y(1) = KA*x(1) - x(3)*x(2);
y(2) = Kow*x(3) - x(4);
y(3) = AnilinOKT - x(3) - x(1) - x(4);
y(4) = x(2) - 10^-pH;