声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1702|回复: 1

[编程技巧] H-H神经元模型放电仿真MATLAB源代码,求解释

[复制链接]
发表于 2011-4-17 16:07 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
代码如下
>> clear; clf;
% maximal conductance (in units of mS/cm^2); 1=K+, 2=Na+, 3=Leakage
g(1)=36; g(2)=120; g(3)=0.3;%was 36 in stead of 40, was .3  
% equilibrium potential for ions
E(1)=-12; E(2)=115; E(3)=10.613;
% Initialization of variables
%I_ext=0;  
V=-10; x=zeros(1,3); x(3)=1; t_rec=0;
% Time step for integration
dt=0.01;%was .01
% Integration with Euler method
I_ext=10;
firings=[];%new addition
diff01=0;
diff12=0;
V0=0;
for t=0:dt:45%was 90
   %if t==1; I_ext=10; end %turn on external current at t=10
  % if t==11; I_ext=0;  end %turn off external current at t=40  
  % if t==50; I_ext=10;  end %turn off external current at t=40  
   %if t==70; I_ext=0;  end %turn off external current at t=40  
   % alpha functions used in the model
   %following 4 lines are new
   V0=V;
    if ((diff12>0) && (diff01<0))
              firings=[firings; t, 1];%record the firing time and the number of corresponding firing neurons
    end
   
   alpha(1)=(10-V)/(100*(exp((10-V)/10)-1));
   alpha(2)=(25-V)/(10*(exp((25-V)/10)-1));
   alpha(3)=0.07*exp(-V/20);
   % beta functions used in the model
   beta(1)=0.125*exp(-V/80);
   beta(2)=4*exp(-V/18);
   beta(3)=1/(exp((30-V)/10)+1);
   % time constant Tau_x and the equilibirum value x_infty
   tau=1./(alpha+beta);% 3 equations
   x_infty=alpha.*tau; % 3 equations
   % Integration with the Euler method
   x=(1-dt./tau).*x+dt./tau.*x_infty;% 3 equations
   % Calculate actual conductance g with given n,m,h
   gnmh(1)=g(1)*x(1)^4;
   gnmh(2)=g(2)*x(2)^3*x(3);
   gnmh(3)=g(3);
   %The internal ion current
   I=gnmh.*(V-E); % 3 equations
   %Update the membrane voltage
   V=V+dt*(I_ext-sum(I));

   %following 6 lines are new
   diff12=diff01;   %diff12 = v(t-1)-v(t-2)
   diff01=V-V0;     %diff01 = v(t-0)-v(t-1)
   
%     if V>30
%            t
%     end
         
   %Record some variables for plotting after equilibration
   if t>=0;
      t_rec=t_rec+1;
      x_plot(t_rec)=t;
      y_plot(t_rec)=V;
   end
end % the end of time loop
firings
plot(x_plot,y_plot); xlabel('Time'); ylabel('Voltage');
回复
分享到:

使用道具 举报

发表于 2011-4-17 21:47 | 显示全部楼层
建议楼主应该自己结合专业知识先研究下程序。把你不明白的地方(程序问题而非专业问题)再贴出来讨论更好些!
建议提问的网友分清 编程问题 和 专业问题 http://forum.vibunion.com/thread-36746-1-1.html
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-29 05:43 , Processed in 0.058343 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表