Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Keep getting error message Index exceeds the number of array elements (1) line 77
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
dt=50*10^-3; %50 microsencods deltatime
stimAmplitude=200;
stimDuration=150;
%Nerst Potential
EK=-72.100;
ENa=52.400;
EL=-49.187;
%Membrane conductivity
gKbar=36.0;
gNabar=120;
gL=0.3;
gK=0.367;
gNa=0.011;
%Gating Probability n,m,h
n=0.41768;
m=0.05293;
h=0.59612;
%Membrane capacitance
Cm=1.00;
%Temper
Temp=6.30;
%Transmembrane Potential
Vm=-60.000;
%Resting Potentail
Vr=-60.000;
%Stimulus Current
Is=0;
%Total membrane current for patch if no stimulus
Im=0;
vm=[];
%Calculations of alpha and Betas for h,n and m
% % a_h=0.07.*exp(-vm./20)
% % b_h=1./((exp((30-vm)/10)+1))
% % a_m=0.1.*((25-vm)./(exp((0.1.*(25-vm)))-1))
% % b_m=4.*exp(-vm/18)
% % a_n=((0.01.*(10-vm))./((exp((10-vm)./10))-1))
% % b_n=0.125.*exp(-vm./80)
%
% %dn
% dn=(a_n.*(1-n))-(b_n.*n)
% dm=(a_m.*(1-m))-(b_m.*m)
% dh=(a_h.*(1-h))-(b_h.*h)
% change in variables
for i = 1:8
vm(i) = Vm(i) - Vr;
Am(i) = ((0.1*(25-vm(i)))/(exp(0.1*(25-vm(i)))-1))*1000; %Alpha & beta for M
Bm(i) = (4*exp(-vm(i)/18))*1000;
dm(i) = (Am(i)*(1-m(i))-Bm(i)*m(i))*dt; % change in M
m(i+1) = m(i)+dm(i); % inital M + change in M
Ah(i) = (0.07*exp(-vm(i)/20))*1000; % H
Bh(i) = (1/(exp((30-vm(i))/10)+1))*1000;
dh(i) = (Ah(i)*(1-h(i))-Bh(i)*h(i))*dt;
h(i+1)= h(i)+dh(i);
An(i) = (0.01*(10-vm(i))/(exp((10-vm(i))/10)-1))*1000; % N
Bn(i) = (0.125*exp(-vm(i)/80))*1000;
dn(i) = (An(i)*(1-n(i))-Bn(i)*n(i))*dt;
n(i+1) = n(i)+dn(i);
gK(i) = gKbar*n(i)^4; % Change in conductance for K & Na
gNa(i) = gNabar*m(i)^3.*h(i);
Ik(i) = gK(i)*(Vm(i)-EK); % Change in current
Ina(i) = gNa(i)*(Vm(i)-ENa);
Il(i) = gL*(Vm(i)-EL);
% Membrane current
dv(i) = dt/Cm*Im(i); % change in voltage
Vm(i+1) = Vm(i) + dv(i)*1000; % membrane voltage
end
1 Kommentar
Mohammad Sami
am 24 Mär. 2020
You defined Im = 0 and then you are trying to use it on line 77 with Im(i). As the for loop increments to 2, it will try to access Im(2), which does not exist.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!