% Derrick Roos % % p_cell_syn.m - P-Cell simulator. This code runs a single p_cell which % is recieving a synaptic connection to help choose ideal conductance and % active time for synapses. A plot is produced. The synapses are modeled as such % % Isyn = G_syn * s * (E_syn - v) % where: G_syn = conductance % s = boolean variable/ stay 1 for time length synapse is active % E_syn = reversal potential for synapse (typically 0mV for % excitory, -90 mV for inhibitory) % v = voltage of cell being synapsed onto % % % vSoma = p_cell(dt,Tcutoff,Tfin,conductance,plot_option,E_syn,syn_compart) % % where: dt = time step % Tcutoff = time that synapse is active for % Tfin = time end simulation % conductance = conductance % plot_option = 0 plots ion and gating channels % 1 plots alpha and tau of gating functions in addition, % 2 no plots come up % E_syn = as above % syn_compart = compartment synapse attaches to (typically 4 for % excitory and 1 "Soma" for inhibitory) % % % ex: p_cell_syn(.01,5,80,.007,0,0,2) exc. synapse % ex2: p_cell_syn(.01,5,80,.007,0,-90,1) inh. synapse function vSoma = p_cell_syn(dt,Tcutoff,Tfin,I0,plot_option,E_syn,syn_compart) V = -100.5:1:50; if plot_option ==1 % plot gating function M_tau = 1./(am(V)+bm(V)); M_inf = am(V).*M_tau; subplot(2,2,1) plotyy(V,M_inf,V,M_tau) title('m channel') ylabel('M_inf') H_tau = 1./(ah(V)+bh(V)); H_inf = ah(V).*H_tau; subplot(2,2,2) plotyy(V,H_inf,V,H_tau) title('h channel') ylabel('H_inf') subplot(2,2,3) N_tau = 1./(an(V)+bn(V)); N_inf = an(V).*N_tau; plotyy(V,N_inf,V,N_tau) title('n channel') ylabel('N_inf') subplot(2,2,4) Q_tau = 1./(aq(V)+bq(V)); Q_inf = aq(V).*Q_tau; plotyy(V,Q_inf,V,Q_tau) title('q channel') ylabel('Q_inf') end % nuimber of compartments comps = 4; % for P-Cell Gm = 0.0032 %soma Cm = 0.032 % soma Gm(2:comps) = 0.0096; Cm(2:comps) = 0.288; Gcore = 0.04; GNa = 1 % mewS vNa = 40; vK = -70; GK = .5; vCa = 150 GCa = 0; GKCA = 0.0017; Gleak = Gm; vLeak = -50; APinflux = 4; APdecay = 30; v1 = -50; N = ceil(Tfin/dt); t = zeros(N,1); % allocate space for long vectors v = zeros(N,comps); n = t; m = t; h = t; q = t; CaAP = t; ICaAP = t; IK = t; INa = t; Istim = zeros(comps,1); n(1) = an(v1)/(an(v1)+bn(v1)); m(1) = am(v1)/(am(v1)+bm(v1)); h(1) = ah(v1)/(ah(v1)+bh(v1)); q(1) = aq(v1)/(aq(v1)+bq(v1)); CaAP(1)=0; v(1,:) = v1; IK(1) = GK*n(1)^4*(vK-v1); INa(1) = GNa*m(1)^3*h(1)*(vNa-v1); ICaAP(1) = 0; for j=2:N, t(j) = (j-1)*dt; % pick compartment for injected current % Istim(2) = I0*(t(j)>2)*(t(j)2)*(t(j)