Octave code for the implementation of hybrid automata for colorectal cancer drug resistance mechanism Main File Code: x0=[4.65928e9; 9e7; 1.8e5; 9e8; 0; 1173; 0]; t=linspace(0,360); lsode_options ("absolute tolerance", 3.5); lsode_options ("relative tolerance", 2.5); range_chemo = [0 0.0625;7 7.0625;14.0 14.0625;21.0 21.0625;28 28.0625;35 35.0625;42.0 42.0625;49.0 49.0625;56.0 56.0625;63.0 63.0625;70.0 70.0625;77.0 77.0625;84.0 84.0625;91.0 91.0625;98.0 98.0625;105.0 105.0625;112.0 112.0625;119.0 119.0625;126.0 126.0625;133.0 133.0625;140.0 140.0625;147 147.0625;154 154.0625;161.0 161.0625;168.0 168.0625;175 175.0625;182 182.0625;189.0 189.0625;196.0 196.0625;203.0 203.0625;210.0 210.0625;217.0 217.0625;224.0 224.0625;231.0 231.0625;238.0 238.0625;245.0 245.0625;252.0 252.0625;259.0 259.0625;266.0 266.0625;273.0 273.0625;280.0 280.0625;287.0 287.0625;294.0 294.0625;301.0 301.0625;308.0 308.0625;315.0 315.0625;322.0 322.0625;329.0 329.0625;336.0 336.0625;343.0 343.0625;350.0 350.0625;357.0 357.0625;364.0 364.0625]; rc_chemo = [0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0]; tt_chemo= @ (z) sigmoid_train (z, range_chemo, rc_chemo); range_mab = [0 0.0833;7.0 7.04167;14.0 14.04167;28 28.04167;42 42.04167;56.0 56.04167;70 70.04167;84 84.04167;98 98.04167;112 112.04167;126 126.04167;140 140.04167;154 154.0833;168.0 168.04167;182.0 182.04167;196 196.04167;210 210.04167;224.0 224.04167;238 238.04167;252 252.04167;266 266.04167;280 280.04167;294 294.04167;308 308.04167;322 322.04167;336 336.04167;350 350.04167;364 364.04167]; rc_mab = [0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0;0 0]; tt_mab= @ (zz) sigmoid_train (zz, range_mab, rc_mab); ktmax=0.81; x=rand (); if (x>ktmax) kt=ktmax; else z=x/ktmax; b=1/3*ktmax; a=(1-z)^-0.67; kt=b*a; endif lsode_options("maximum step size",0.01); y = lsode (@ (x,t) xdot (x,t,tt_chemo,tt_mab,kt), x0, t); A = (y(:,1)) B = (y(:,2)); C = (y(:,3)); D = (y(:,4)); E = (y(:,5)); F = (y(:,6)); G = (y(:,7)); axis tight semilogy(t,A,'linewidth',2) xlabel('Time (Days)') ylabel('Tumor Cells Conc.') title('Immune response to combination therapy') Function: function xdot = f(x,t,tt_chemo,tt_mab,kt) global vmt; global vat; global di; a=0.23100; b=2.146e-10; c= 5.156e-14; rnk=6.5e-10; h1=1.25e-6; kat=0.0004; deltat=2e-1; mab=2.28e-2; e=0.002; f=1e-2; p=5.156e-14; pa= 6.5e-10; pn=5.13e-2; gn=2.5036e5; kn= 9.048e-1; deltan=2e-1; theta=2.5036e-3; m=5e-3; j=1.245e-4; k=2.019e7; q=5.156e-17; r1=5.156e-12; r2=1e-15; u=3.1718e-14; ks=2.5036e3; kl=4.524e-1; deltal=2e-1; pi=2.4036; gi=2.5036e3; alpha=3e9; beta=6.3e-3; kc=5.7e-1; deltac=2e-1; ui=11.7427; phi=1.788e-7; w=7.88e-2; wi=2.5036e3; n=1.386e-1; lambda=8.9e-14; h2=4.45e-5; di=-0.2; ktt=6.1e-1; xdot=zeros(7,1); xdot(1)= ((a*x(1))*(1-(b*x(1)))) - ((c+ (rnk* (x(7)/(h1+x(7)))))*x(2)*x(1)) - (di.*x(1))- (((ktt+ (kat*x(7)))*(1-(exp(-deltat*x(5)))))* x(1)) - (mab*x(7)*x(1)); xdot(2)= (e*x(4)) - (f*x(2)) - (((p+(pa*(x(7)/(h1+x(7)))))*x(2))*x(1)) + ((pn*x(2)*x(6))/(gn+x(6))) - ((kn*(1-(exp(-(deltan * x(5))))))*x(2)); xdot(3)= ((theta*m*x(3))/(theta+x(6))) + ((j*(x(1)/(k+x(1))))*x(3)) - (q*x(3)*x(1)) + (((r1*x(2))+ (r2*x(4)))*x(1)) - ((u*((x(3)).^2)*x(4)*x(6))/(ks+x(6))) - ((kl*(1-(exp(-(deltal*x(5))))))*x(3)) + ((pi*x(3)*x(6))/(gi+x(6))); xdot(4)= alpha - (beta*x(4)) - ((kc*(1-(exp(-(deltac*x(5))))))*x(4)); s=tt_chemo(t)*57.947; xdot(5)= (-(0.40770 )* x(5))+s ; xdot(6)= (-ui*x(6)) + (phi*x(4)) + ((w*x(3)*x(6))/(wi+x(6))); if (t==0) ss=tt_mab(t)+69.536; xdot(7)= ((-n)*x(7)) -((lambda*x(1))*(x(7)/(h2+x(7))))+ss; else sss=tt_mab(t)*173.840; xdot(7)= ((-n)*x(7)) - ((lambda*x(1))*(x(7)/(h2+x(7))))+sss; endif endfunction