Nerve Graphs on MatLab, Assignments of Software Project Management

Graphs programmed on MatLab and put into PDF

Typology: Assignments

2023/2024

Uploaded on 03/07/2024

sophia-gonzalez-13
sophia-gonzalez-13 🇺🇸

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CODE:
%Define constants
E_Na = 45.0; % mV
E_K = -82.0; % mV
E_L = -59.0; % mV
gbarNa = 120.0; % mA*ms/cm^2
gbarK = 36.0; % mA*ms/cm^2
gbarL = 0.3; % mA*ms/cm^2
Cm=1; % uF/cm^2
n0=0.3177;
m0=0.0529;
h0=0.5961;
V0=-70; % mV
% Set up time vector
Total_time=45; %ms
deltaT=0.01; %Timestep in ms
t=0:deltaT:Total_time; %time vector t
%--Set the stimulus current--%
pf3
pf4

Partial preview of the text

Download Nerve Graphs on MatLab and more Assignments Software Project Management in PDF only on Docsity!

CODE:

%Define constants E_Na = 45.0; % mV E_K = -82.0; % mV E_L = -59.0; % mV gbarNa = 120.0; % mAms/cm^ gbarK = 36.0; % mAms/cm^ gbarL = 0.3; % mA*ms/cm^ Cm=1; % uF/cm^ n0=0.3177; m0=0.0529; h0=0.5961; V0=-70; % mV % Set up time vector Total_time=45; %ms deltaT=0.01; %Timestep in ms t=0:deltaT:Total_time; %time vector t %--Set the stimulus current--%

Ip=15; % stim pulse current amplitude, uA tp_start=0; % stim current start time, ms tp_stop=1; % stim current stop time, ms % Set up stimulus current vector I_stim=zeros(1,numel(t)); %Compute tp_start_index if tp_start== tp_start_index=1; else tp_start_index = tp_start/deltaT; end %compute tp_stop_index tp_stop_index=tp_stop/deltaT; % Stimulus current pulse I_stim(tp_start_index:tp_stop_index)=Ip; %plot figure;plot(t,I_stim) %main loop %initial conditions Vm=zeros(1,numel(t)); alpha_m=zeros(1,numel(t)); beta_m=zeros(1,numel(t)); alpha_n=zeros(1,numel(t)); beta_n=zeros(1,numel(t)); alpha_h=zeros(1,numel(t)); beta_h=zeros(1,numel(t)); Vm(1)=V0; n(1)=n0; m(1)=m0; h(1)=h0; for i=1:numel(t)- %calculating rate coefficients alpha_m(i)=((Vm(i)+45)/10)/(1-exp(-(Vm(i)+45)/10)); beta_m(i)= (exp(-(Vm(i)+70)/18)4); alpha_n(i)= (((Vm(i)+60)/10)/(1-exp(-(Vm(i)+45)/10)))/10; beta_n(i)= (exp(-(Vm(i)+70)/80)0.125); alpha_h(i)=(exp(-(Vm(i)+70)/20)*0.07); beta_h(i)=1/(1+exp(-(Vm(i)+40)/10));

subplot(4,1,3); plot(t,gNa,'r'); grid minor hold on plot(t,gK,'g'); legend('Sodium Ion Conductance gNa', 'Potassium Ion Conductance gK'); ylabel("Ionic Conductances"); xlabel('Time (ms)'); title('Ionic Conductances vs Time'); subplot(4,1,4);plot(t, I_stim, 'b'); grid on ylabel('Stimulus Current (μA)'); xlabel('Time (m/s)'); title('Stimulus Current vs Time');