function f = cstrrxns(C)

load cstrrxns.mat

%Done on 19-Mar-2001, M.Subramanian

% The data stored in cstrrxns.mat are:
%k1 = 1.0; k2 = 0.2; k3 = 0.05; k4 = 0.4; Cao = 1; t = 2;

%F1 = -Ca + Cao [-k1Ca - k2Ca^3/2 + k3Cc^2]t = 0
%F2 = -Cb + [2k1Ca - k4Cb^2]t = 0
%F3 = -Cc + [k2Ca^3/2 - k3Cc^2 + k4Cb^2]t = 0
%F4 = -Cd + [k4Cb^2]t = 0

f(1) = -C(1) + Cao + (-k1*C(1) - k2* C(1)*sqrt(C(1)) + k3*C(3)*C(3))*t;
f(2) = -C(2) + (2*k1*C(1) - k4*C(2)*C(2))*t;
f(3) = -C(3) + (k2*(C(1)^(3/2)) - k3*C(3)*C(3) + k4*C(2)*C(2))*t;
f(4) = -C(4)+ ( k4*C(2)*C(2) )*t;

% Initial values for iteration: 
%C0 = [1 0 0 0]'

% Issue the command:
%C = fsolve('cstrrxns', C0, 5)
%The result will be
% Ca = 0.3189; Cb = 0.7839; Cc = 0.5350; Cd = 0.4916
%-----------------------------------------------------

