function cdot = ex45(t, c)
% 
% this file defines the differential equation set (4.3.37) - (4.3.52), 
% c(1)=G, c(2)=M, c(3)=N, c(4)=T;
%

G0 = 70;
M0 = 220;
N0 = 40;
X0 = 175;

REG = 1.92;	RXG = 0.134;	HFG = -91.3*10^3;
REM = 3.84; 	RXM = 0.268;	HFM = -226.3*10^3;
REN = 5.76; 	RXN = 0.402;	HFN = -361.3*10^3;

EVG = 22.6*10^3;	VG0 = 35.77;
EVM = 11.3*10^3;	VM0 = 16.40;
EVN = 7.16*10^3;	VN0 = 10.50;

EKG = -68.6*10^3;	KG0 = -121.30;
EKM = -14.4*10^3;	KM0 = -19.15;
EKN = -19.9*10^3;	KN0 = -26.78;

EKGprime = 10.2*10^3;	KG0prime = 23.33;
EKMprime = 26.3*10^3;	KM0prime = 55.61;

A = 0.188; 		% m^2
Cp = 4016;		% J/(kg.C)
rho = 1040;		% kg/m^3
V = 0.1;		% m^3
Kp = 1*10^6;		% J/(hr.C^2.m^3)
Tset = 12;		% C
umin = 0;		% J/(hr.C.m^3)
umax = 40000;
Tc = 0;			% C
R = 1.9855;             % cal/(mol.K)

u = Kp*(c(4)-Tset);
if u < umin
    u = umin;
end
if u > umax
    u = umax;
end
U = u*V/A;

VG = exp(VG0 -EVG/(R*(c(4)+273)));
VM = exp(VM0 -EVM/(R*(c(4)+273)));
VN = exp(VN0 -EVN/(R*(c(4)+273)));
KG = exp(KG0 -EKG/(R*(c(4)+273)));
KM = exp(KM0 -EKM/(R*(c(4)+273)));
KN = exp(KN0 -EKN/(R*(c(4)+273)));
KGprime = exp(KG0prime -EKGprime/(R*(c(4)+273)));
KMprime = exp(KM0prime -EKMprime/(R*(c(4)+273)));

mu1 = VG*c(1)/(KG+c(1));
mu2 = VM*c(2)/(KM+c(2))*KGprime/(KGprime+c(1));
mu3 = VN*c(3)/(KN+c(3))*KGprime/(KGprime+c(1))*KMprime/(KMprime+c(2));

X = X0 + RXG*(G0-c(1)) + RXM*(M0-c(2)) + RXN*(N0-c(3));
E = REG*(G0-c(1)) + REM*(M0-c(2)) + REN*(N0-c(3));

cdot(1) = -mu1 * X;
cdot(2) = -mu2 * X;
cdot(3) = -mu3 * X;
cdot(4) = 1/(rho*Cp)*(HFG*cdot(1) + HFM*cdot(2) + HFN*cdot(3) - u*(c(4)-Tc));
cdot = cdot(:);