Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems
-
Upload
serc-at-carleton-college -
Category
Documents
-
view
36 -
download
4
Transcript of Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems
![Page 1: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/1.jpg)
Cracking the Code: Using quantitative models in Matlab
to solve problems
M. Letitia Hubbard, PhD North Carolina School of Science and Math, Durham, NC
![Page 2: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/2.jpg)
Steps to developing a quantitative model that be used to solve problems• STEP 1: Understand the physical basis for the model• STEP 2: Understand numerical methods and be able to
compute them by hand• STEP 3: Translate equations into Matlab code to create a
computational tool• STEP 4: Use simulation to explore the impact of different
variables on the model.
![Page 3: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/3.jpg)
The HH Model: The Excitable Cell•Neurons are a type of excitable
cell.
• The three main components of an excitable cell are • the charged ions • the cell membrane • voltage-gated ion channels
http://www.cytherapharm.com/research.html
![Page 4: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/4.jpg)
The HH Model: The Action Potential• The action potential is the change in
membrane voltage in response to the movement of three major ions (K+, Na2+, Cl-)
• The ion channels have gates that open and close at different times during the action potential and this helps to balance the diffusive force and electric field forces across the membrane.
![Page 5: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/5.jpg)
The HH Model: The Parallel Conductance Model• Cell membrane = capacitor• Voltage gated ion channels =
variable resistors (conductances)• Nernst Potential (balance
between electric field and diffusion force) = battery
Equations for Currents:
http://www.genesis-sim.org/cnslecs/cns1.html
![Page 6: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/6.jpg)
The HH Model: The Differential Equation for the Transmembrane Potential• The transmembrane potential is
governed by the differential equation:• • Istim is the current injected into the
cell • Cm is the specific membrane
capacitance of 1μF/cm2
![Page 7: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/7.jpg)
The HH Model: The Differential Equations for The Gating Variables
The rate constants, alpha and beta are calculated as follows:
The Gating Variables
![Page 8: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/8.jpg)
Numerical Methods• The approach we will use is to solve all the governing ODE using an
approximation. The simplest of these (and least accurate) is the Forward Euler method, where you estimate the next answer using the previous answer (explicit method).
• Using the Forward Euler approximation, we can represent the differential equations as:
•
![Page 9: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/9.jpg)
Translate equations into MATLAB codefunction [outputv]=HH_Patch
%INPUTSTOT_TIME=20; %msdt=.01;%Timestep in mssavedata=20;NTSTEPS=round(TOT_TIME/dt); %Number of Timestepstvect=dt*[1:NTSTEPS]; %Time Vector %%%% SET THE STIMULUS PARAMETERS %%%%stimval=20; %uA/cm2stimdur=2; %ms
![Page 10: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/10.jpg)
Translate equations into MATLAB code%CONSTANTSGNA = 120.0; % mS/cm^2GK = 36.0; % mS/cm^2GLEAK = 0.3; % mS/cm^2ENA = 115.0; % mVEK = -12.0; % mVELEAK = 10.613; % mVCm=1; %uF/cm^2
%Initial Conditionsoutputv=[zeros(1,length(tvect)/20)];v=0;m = alpham1(v)./(alpham1(v)+betam1(v)); % initial (steady-state) mh = alphah1(v)./(alphah1(v)+betah1(v)); % initial (steady-state) hn = alphan1(v)./(alphan1(v)+betan1(v));Istim=0;
![Page 11: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/11.jpg)
Skeleton Codefor i=1:NTSTEPS; %Apply square wave stimulus to the first three nodes if (i< round(stimdur/dt)) Istim=stimval; else Istim=0; end %Calculate IionIion =???????????;
![Page 12: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/12.jpg)
Skeleton Code%Calculate next m,n,h m=m+dt.*(alpham1(v).*(1-m) -betam1(v).*m); n=n+dt.*(alphan1(v).*(1-n) -betan1(v).*n); h=h+dt.*(alphah1(v).*(1-h) -betah1(v).*h); %Calculate membrane potential at the next step vold=v; vnew=????????; v=vnew;
![Page 13: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/13.jpg)
Skeleton Functions to calculate rate constantsfunction rc=alphah1(v) rc = 0.07 .* exp(-v./20.0);function rc=alpham1(v) rc = ????;function rc=alphan1(v) rc = ????;function rc=betam1(v) rc = ????;function rc=betah1(v) rc = ????;function rc=betan1(v) rc = ????;
![Page 14: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/14.jpg)
Code to Output Data%this section is to determine when to dump the output
cnt=cnt+1;
figure(1000)
% Plot action potential as a function of t
if cnt==savedata
hold off
hh=subplot(1,1,1);
outputv(plotcount)=v;
plot(tvect(1:savedata:i),outputv(1:plotcount)), axis([0 tvect(end) -20 120]);
set(get(hh,'XLabel'),'String','Time (ms)');
set(get(hh,'YLabel'),'String','Voltage (mV)');
cnt=0;plotcount = plotcount+1;
drawnow % you need this to get MATLAB to draw each time
end
end
![Page 15: Cracking the Code: Using Quantitative Models in MATLAB to Solve Problems](https://reader036.fdocuments.in/reader036/viewer/2022062400/589ad6211a28abc93a8b63db/html5/thumbnails/15.jpg)
Use simulation to explore different variables
Test Strength-Duration Relationship• %%%% SET THE STIMULUS PARAMETERS %%%%• stimval=20; %uA/cm2
• stimdur=2; %ms
Generate an Action Potential