Golgi_CaLVA_defs = "Golgi_CaLVA.m" ; autoload ("Golgi_CaLVA" , Golgi_CaLVA_defs) ; autoload ("Golgi_CaLVA_init" , Golgi_CaLVA_defs) ; global celsius ca2i ca2o celsius = 23; ca2i = 50e-5; ca2o = 2.0; Golgi_CaLVA_init ; y0 = Golgi_CaLVA_init (-65) ; global N ; N = length (y0) ; function is = Golgi_CaLVA_currents_odepkg (y) global N ; global i_CaLVA ; t = y (1) ; s = y (2:N+1) ; y1 = Golgi_CaLVA (t , s) ; is = [ t i_CaLVA ] ; endfunction function is = Golgi_CaLVA_currents_lsode (y) global N ; global i_CaLVA ; t = y (1) ; s = y (2:N+1) ; y1 = Golgi_CaLVA (s , t) ; is = [ t i_CaLVA ] ; endfunction function ys = Golgi_CaLVA_vclamp_run1_odepkg (N , dt , vchold , vchdur , vcbase , vcdur) global reltol abstol P = odeset ("RelTol" , reltol , "AbsTol" , abstol , "MaxStep" , 1 , "InitialStep" , dt) ; t0 = 0.0 ; t1 = t0+vchdur ; t2 = t1 ; t3 = t2+vcdur ; t4 = t3 ; t5 = t4+vchdur ; vinit = vchold ; y0 = Golgi_CaLVA_init (vinit) sol = ode2r (@Golgi_CaLVA , [ t0 t1 ] , y0 , P) ; ys = [ sol.x sol.y ] ; vinit = vcbase ; y0 = sol.y (size (sol.y) (1) , :) ' ; y0 (1) = vinit sol = ode2r (@Golgi_CaLVA , [ t2 t3 ] , y0 , P) ; ys = vertcat (ys , [ sol.x sol.y ]) ; vinit = vchold ; y0 = sol.y (size (sol.y) (1) , :) ' ; y0 (1) = vinit sol = ode2r (@Golgi_CaLVA , [ t4 t5 ] , y0 , P) ; ys = vertcat (ys , [ sol.x sol.y ]) ; endfunction ; function ys = Golgi_CaLVA_vclamp_run1_lsode (N , dt , vchold , vchdur , vcbase , vcdur) global reltol abstol lsode_options ("absolute tolerance" , abstol) ; lsode_options ("relative tolerance" , reltol) ; lsode_options ("integration method" , "bdf") ; lsode_options ("initial step size" , dt) ; t0 = 0.0 ; t1 = t0+vchdur ; thold0 = linspace (t0 , t1 , (t1-t0) /dt) ; t2 = t1 ; t3 = t2+vcdur ; tclamp = linspace (t2 , t3 , (t3-t2) /dt) ; t4 = t3 ; t5 = t4+vchdur ; thold1 = linspace (t4 , t5 , (t5-t4) /dt) ; vinit = vchold ; y0 = Golgi_CaLVA_init (vinit) y = lsode (@Golgi_CaLVA , y0 , thold0) ; ys = [ thold0' y ] ; vinit = vcbase ; y0 = y (size (y) (1) , :) ' ; y0 (1) = vinit y = lsode (@Golgi_CaLVA , y0 , tclamp) ; ys = vertcat (ys , [ tclamp' y ]) ; vinit = vchold ; y0 = y (size (y) (1) , :) ' ; y0 (1) = vinit y = lsode (@Golgi_CaLVA , y0 , thold1) ; ys = vertcat (ys , [ thold1' y ]) ; endfunction function ilog = Golgi_CaLVA_vclamp_fn (N , dt , vchold , vchdur , vcbase , vcdur , vcinc , vcsteps) vc = vcbase ; ys = cell (1 , vcsteps) ; for i = 1:vcsteps y = Golgi_CaLVA_vclamp_run1_odepkg (N , dt , vchold , vchdur , vc , vcdur) ; ys (i) = y ; vc = vc + vcinc ; endfor ; ilog = cell (vcsteps , 1) ; for i = 1:vcsteps ilogv = [ ] ; n = size (ys {i}) (1) ; for j = 1:n next = Golgi_CaLVA_currents_odepkg (ys {i} (j , :)) ; ilogv = vertcat (ilogv , next) ; endfor ; ilog {i} = ilogv ; endfor ; endfunction global reltol abstol reltol = 1e-03 ; abstol = 1e-03 ; dt = 0.001 ; ## i_CaLVA plot i_CaLVA_index = 2 ; global comp303_vchold comp303_vchdur comp303_vcbase comp303_vcbdur comp303_vcinc comp303_vcsteps Golgi_CaLVA_ilog = Golgi_CaLVA_vclamp_fn (N , dt , comp303_vchold , comp303_vchdur , comp303_vcbase , comp303_vcbdur , comp303_vcinc , comp303_vcsteps) ; subplot (1 , 3 , 1) ; plot (Golgi_CaLVA_ilog{1}(:,1) , Golgi_CaLVA_ilog{1}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{2}(:,1) , Golgi_CaLVA_ilog{2}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{3}(:,1) , Golgi_CaLVA_ilog{3}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{4}(:,1) , Golgi_CaLVA_ilog{4}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{5}(:,1) , Golgi_CaLVA_ilog{5}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{6}(:,1) , Golgi_CaLVA_ilog{6}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{7}(:,1) , Golgi_CaLVA_ilog{7}(:,i_CaLVA_index) , Golgi_CaLVA_ilog{8}(:,1) , Golgi_CaLVA_ilog{8}(:,i_CaLVA_index)) ; CaLVA_log = vertcat ([Golgi_CaLVA_ilog{1}(:,1),Golgi_CaLVA_ilog{1}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{2}(:,1),Golgi_CaLVA_ilog{2}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{3}(:,1),Golgi_CaLVA_ilog{3}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{4}(:,1),Golgi_CaLVA_ilog{4}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{5}(:,1),Golgi_CaLVA_ilog{5}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{6}(:,1),Golgi_CaLVA_ilog{6}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{7}(:,1),Golgi_CaLVA_ilog{7}(:,i_CaLVA_index)] , [Golgi_CaLVA_ilog{8}(:,1),Golgi_CaLVA_ilog{8}(:,i_CaLVA_index)]) ; save -ascii "CaLVA.dat" CaLVA_log ;