% F2_7_VoltageClamp % Carol Lucas % This routine runs through equations 2.28 and 2.29 for several values of V % V is assumed to be a step function that always starts at -60 mV, % changes to clamped value at t=10 ms, and returns to -60 mV at 50 ms % Yields the graphs shown in Figure 2.7 Vo=-25;So=5;A=10;g=2;Vrev=-65;tstart=0;tend=60;noin=0.0; k=1;t=[tstart:.5:tend]; clear i; figure(1);clf;plot([tstart tend],[0 0]);axis([tstart tend 0 200]); xlabel('time (ms)'),ylabel('current pA');hold on; for V=-60:5:10 [t,no]=ode45('vcfun',t,noin,[],V,Vo,So,A); i=g*no*(V-Vrev); ninf(k)=.5*(1+tanh((V-Vo)/(2*So))); tau(k)=A/cosh((V-Vo)/(2*So)); imax(k)=g*ninf(k)*(V-Vrev); figure(1);plot(t,i);text(40,imax(k),strcat('V=',int2str(V)));pause (1); Vsave(k)=V; k=k+1; end input('Hit any key to view voltage dependencies '); figure(2);clf;subplot(211);plot(Vsave,imax,'r+-'); xlabel('voltage (mV)'),ylabel('maximum current (pA)'); title('voltage dependencies of current max, tau, and ninf'); subplot(223);plot(Vsave,ninf,'b+-'); xlabel('voltage (mV)'),ylabel('ninf'); subplot(224);plot(Vsave,tau,'g+-'); xlabel('voltage (mV)'),ylabel('tau');pause;