function Main() t0 = 0; tf = 10000; hr = 1; DA_s = 100; Ach_s = 100; HT_s = 100; Glu_s = 200; NA_s = 100; GABA_s = 150; Xd0(1) = DA_s; Xd0(2) = Ach_s; Xd0(3) = HT_s; Xd0(4) = Glu_s; Xd0(5) = NA_s; Xd0(6) = GABA_s; Kda_synthesis = 1; Kach_synthesis = 1; Kht_synthesis = 1 ; Kglu_synthesis = 1; Kna_synthesis = 1; Kgaba_synthesis = 1; Gda_ach = 0.5; Gda_ht = 0.20; Gda_glu = 0.5; Gda_na = 0.5; Gda_gaba = -0.3; Hda_da = 1; Gach_da = -0.3; Gach_ht = -0.3; Gach_glu = 0.5; Gach_na = -0.3; Gach_gaba = -0.3; Hach_ach = 1 ; Ght_da = -0.2; Ght_ach = 0.5; Ght_glu = 0.5; Ght_na = -0.3; Ght_gaba = -0.3 ; Hht_ht = 1; Gglu_da = -0.3; Gglu_ach = 0.5; Gglu_ht = 0.5; Gglu_na = 0.5; Gglu_gaba = -0.3; Hglu_glu = 1; Gna_da = 0.5 ; Gna_ach = 0.5; Gna_ht = 0.5 ; Gna_glu = 0.5; Gna_gaba = -0.3; Hna_na = 1; Ggaba_da = -0.3; Ggaba_ach = 0.5; Ggaba_ht = -0.3; Ggaba_glu = 0.5; Ggaba_na = -0.3; Hgaba_gaba = 1; Wht = 1; Wda = 1; Wglu = 1; Wgaba = 1; Wht_da = 1; Wna = 1; Wglu_gaba = 1; Wach = 1; Wht_da_na = 1; Wach_glu_gaba = 1; Kda_degradation = Kda_synthesis *Ach_s^Gda_ach *HT_s^Gda_ht *Glu_s^Gda_glu *NA_s^Gda_na *GABA_s^Gda_gaba / DA_s^Hda_da; Kach_degradation = Kach_synthesis *DA_s^Gach_da *HT_s^Gach_ht *Glu_s^Gach_glu *NA_s^Gach_na *GABA_s^Gach_gaba / Ach_s^Hach_ach; Kht_degradation = Kht_synthesis *DA_s^Ght_da *Ach_s^Ght_ach *Glu_s^Ght_glu *NA_s^Ght_na *GABA_s^Ght_gaba / HT_s^Hht_ht; Kglu_degradation = Kglu_synthesis *DA_s^Gglu_da *Ach_s^Gglu_ach *HT_s^Gglu_ht *NA_s^Gglu_na *GABA_s^Gglu_gaba / Glu_s^Hglu_glu; Kna_degradation = Kna_synthesis *DA_s^Gna_da *Ach_s^Gna_ach *HT_s^Gna_ht *Glu_s^Gna_glu *GABA_s^Gna_gaba / NA_s^Hna_na; Kgaba_degradation = Kgaba_synthesis *DA_s^Ggaba_da *Ach_s^Ggaba_ach *HT_s^Ggaba_ht *Glu_s^Ggaba_glu *NA_s^Ggaba_na / GABA_s^Hgaba_gaba; Wda = Wht * HT_s / DA_s ssBalance_HT_DA = Wht * HT_s - Wda * DA_s ssGain_HT_DA = HT_s + DA_s Wgaba = Wglu * Glu_s / GABA_s ssBalance_Glu_GABA = Wglu * Glu_s - Wgaba * GABA_s ssGain_Glu_GABA = Glu_s + GABA_s Wna = Wht_da * ssGain_HT_DA / NA_s ssBalance_HT_DA_NA = Wht_da * ssGain_HT_DA - Wna * NA_s ssGain_HT_DA_NA = ssGain_HT_DA + NA_s Wach = Wglu_gaba * ssGain_Glu_GABA / Ach_s ssBalance_Ach_Glu_GABA = Wach * Ach_s - Wglu_gaba * ssGain_Glu_GABA ssGain_Ach_Glu_GABA = Ach_s + ssGain_Glu_GABA Wach_glu_gaba = Wht_da_na * ssGain_HT_DA_NA / ssGain_Ach_Glu_GABA ssOverallBalance = Wht_da_na * ssGain_HT_DA_NA - Wach_glu_gaba * ssGain_Ach_Glu_GABA ssOverallGain = ssGain_HT_DA_NA + ssGain_Ach_Glu_GABA t1span = [t0: hr: tf]; options = odeset('NonNegative', ones(size(Xd0)), 'OutputFcn', @odeplot, 'stats', 'on', 'RelTol', 1E-5, 'AbsTol', 1E-6); [tspan, Xd] = ode23s(@Mobile, t1span, Xd0, [], Kda_synthesis, Kda_degradation, Gda_ach, Gda_ht, Gda_glu, Gda_na, Gda_gaba, Hda_da, ... Kach_synthesis, Kach_degradation, Gach_da , Gach_ht , Gach_glu, Gach_na, Gach_gaba, Hach_ach, Kht_synthesis, Kht_degradation, Ght_da, Ght_ach, Ght_glu, Ght_na, Ght_gaba, Hht_ht, ... Kglu_synthesis, Kglu_degradation, Gglu_da, Gglu_ach, Gglu_ht, Gglu_na, Gglu_gaba, Hglu_glu, Kna_synthesis, Kna_degradation, Gna_da, Gna_ach, Gna_ht, Gna_glu, Gna_gaba, Hna_na, ... Kgaba_synthesis, Kgaba_degradation, Ggaba_da, Ggaba_ach, Ggaba_ht, Ggaba_glu, Ggaba_na, Hgaba_gaba, Wht, Wda, Wglu, Wgaba, Wht_da, Wna, Wglu_gaba, Wach, Wht_da_na, Wach_glu_gaba, options); Dynamics_DA = Xd(:, 1); Dynamics_Ach = Xd(:, 2); Dynamics_HT = Xd(:, 3); Dynamics_Glu = Xd(:, 4); Dynamics_NA = Xd(:, 5); Dynamics_GABA = Xd(:, 6); end function [dxdt] = Mobile(t, Xd, Kda_synthesis, Kda_degradation, Gda_ach, Gda_ht, Gda_glu, Gda_na, Gda_gaba, Hda_da, ... Kach_synthesis, Kach_degradation, Gach_da , Gach_ht , Gach_glu, Gach_na, Gach_gaba, Hach_ach, Kht_synthesis, Kht_degradation, Ght_da, Ght_ach, Ght_glu, Ght_na, Ght_gaba, Hht_ht, ... Kglu_synthesis, Kglu_degradation, Gglu_da, Gglu_ach, Gglu_ht, Gglu_na, Gglu_gaba, Hglu_glu, Kna_synthesis, Kna_degradation, Gna_da, Gna_ach, Gna_ht, Gna_glu, Gna_gaba, Hna_na, ... Kgaba_synthesis, Kgaba_degradation, Ggaba_da, Ggaba_ach, Ggaba_ht, Ggaba_glu, Ggaba_na, Hgaba_gaba, Wht, Wda, Wglu, Wgaba, Wht_da, Wna, Wglu_gaba, Wach, Wht_da_na, Wach_glu_gaba, options); DA = Xd(1); Ach = Xd(2); HT = Xd(3); Glu = Xd(4); NA = Xd(5); GABA = Xd(6); Vda_synthesis = Kda_synthesis*Ach^Gda_ach*HT^Gda_ht*Glu^Gda_glu*NA^Gda_na*GABA^Gda_gaba; Vda_degradation = Kda_degradation*DA^Hda_da ; Vach_synthesis = Kach_synthesis*DA^Gach_da*HT^Gach_ht*Glu^Gach_glu*NA^Gach_na*GABA^Gach_gaba ; Vach_degradation = Kach_degradation*Ach^Hach_ach ; Vht_synthesis = Kht_synthesis*DA^Ght_da*Ach^Ght_ach*Glu^Ght_glu*NA^Ght_na*GABA^Ght_gaba; Vht_degradation = Kht_degradation*HT^Hht_ht ; Vglu_synthesis = Kglu_synthesis*DA^Gglu_da*Ach^Gglu_ach*HT^Gglu_ht*NA^Gglu_na*GABA^Gglu_gaba ; Vglu_degradation = Kglu_degradation*Glu^Hglu_glu ; Vna_synthesis = Kna_synthesis*DA^Gna_da*Ach^Gna_ach*HT^Gna_ht*Glu^Gna_glu*GABA^Gna_gaba; Vna_degradation = Kna_degradation*NA^Hna_na ; Vgaba_synthesis = Kgaba_synthesis*DA^Ggaba_da*Ach^Ggaba_ach*HT^Ggaba_ht*Glu^Ggaba_glu*NA^Ggaba_na ; Vgaba_degradation = Kgaba_degradation*GABA^Hgaba_gaba; % DA = Xd(1) dxdt(1, 1) = +Vda_synthesis-Vda_degradation; % Ach = Xd(2) dxdt(2, 1) = +Vach_synthesis-Vach_degradation; % HT = Xd(3) dxdt(3, 1) = +Vht_synthesis-Vht_degradation; % Glu = Xd(4) dxdt(4, 1) = +Vglu_synthesis-Vglu_degradation; % NA = Xd(5) dxdt(5, 1) = +Vna_synthesis-Vna_degradation; % GABA = Xd(6) dxdt(6, 1) = +Vgaba_synthesis-Vgaba_degradation; return; end