%This code was written for Bi250b by Emmanuel Lorenzo de los Santos (1/17/12)


function dv_dt = prob1(t,v,flag,Kxz,Kxy,Kyz,beta_x,beta_basal),
dv_dt = [0;0;0]; % x,y,z
x = v(1);
y = v(2);
z = v(3);

dv_dt(1) = beta_x - x;

if x > Kxy,
    dv_dt(2) = 1 - y;
else
    dv_dt(2) = -y;
end

if x > Kxz && y > Kyz,
    dv_dt(3) = beta_basal - z;
elseif x > Kxz
    dv_dt(3) = 1 - z;
else
    dv_dt(3) = -z;
end

end
