# Modeling an Neuron Action Potential in Matlab

## Summary

This lab activity is designed to teach students (1) to transform the Hodgkin-Huxley (HH) membrane model into a programmable set of equations (2) To create a working membrane patch model in MATLAB using HH kinetics (3) To perform simulations to investigate the response of the membrane to different stimuli. At the conclusion of this lab, students should be familiar with model development and should understand how to interpret data from a simulation of a Hodgkin-Huxley model of a neuron.

## Learning Goals

Students will learn how to take equations from a mathematical model and translate them into a MATLAB computer program. They should learn how to define constants, variables, conditional statements and loops and write functions based on an example code that is given to them to modify. Students will analyze the data generated by the computational model that they create and use simulation to explore the effect of changing different parameters on the model behavior.

## Context for Use

This is a 3-hour lab activity for advanced high school and college undergraduate students with a high level understanding of electrophysiology concepts such as action potentials and Hodgkin-Huxley kinetics, differential equations and simple numerical methods such as Forward Euler. Students should be familiar with basic programming concepts including functions, conditional statements, and loops but may not have used Matlab extensively. Students should also be comfortable displaying and interpreting plots in Matlab.

## Description and Teaching Materials

Please see the Background Information, Hodgkin Huxley Equations, and Methods section that accompanies this Description.

Background, Hodgkin Huxley Equations, and Methods (Acrobat (PDF) 66kB Oct24 16)

MATLAB Info
In this activity we will be using MATLAB functions for the rate constants (a,b) in order to construct a HH membrane patch.
In MATLAB you can write your own functions to help organize your code. Below is a quick example on how to create and use functions:
All functions in MATLAB have the same syntax, shown below:

function [output1, output2] = function_name(input1, input2)

%

%

In order to call that function from your program or the command line you need to
simply type:

[output1, output2] = function_name(input1, input2)

This will return two outputs (output1, output2) given two inputs (input1, input2). The number of inputs and outputs is arbitrary and you may set as many as you need.

When you are going to be performing the same operation many times, functions are very useful and can simplify your code. One use of functions in the HH model is for the calculation of the rate constants as a function of membrane voltage.

It is important to note that variables in the function are local to that function. If you want the variables to be available to another function or the main workspace, you will need to pass the variables as output variables or make them global variables. See the help on global variables.

Write a program that simulates HH membrane behavior.

1) Copy the HH_Patch_Shell.m file into your working directory as a starting point. The functions for alpha_m and beta_m are at the bottom of the HH_Patch_Shell.m file. You will need to create the appropriate functions for alpha_n and beta_n, and alpha_h and beta_h.

Skeleton Code for the HH Patch Model (Matlab File 2kB Oct24 16)

2) You will need to add code to the file to calculate Iion, vm, m, n, and h at the next timestep.

3) You will also need to figure out a way to introduce a stimulus current pulse with a user controlled amplitude and duration.

The HH_Patch_Shell.m file contains code to save the appropriate variables at selected time steps so that you can plot the currents, membrane potential and gating parameters as a function of time.

Once you have verified that your program reproduces the HH action potential complete the Assessment portion of the lab.

## Teaching Notes and Tips

*This lab can be modified for less advanced students by giving the students the completed computational model and having them run the simulations in the assessment.

*This lab can be modified for more advanced students by 1) having them calculate eL so that Iion=0 at rest and 2) having them plot the gating variables m,n, and h, and the conductances gKand gNa as a function of time

## Assessment

At the conclusion of the lab, the students should be able to complete the following two tasks for assessment.

A) Generate a plot that shows vm as a function of time for a stimulus is that 2 times threshold for a duration of 0.5 msec.

B) Threshold and Strength-Duration Relationship

Set the simulation time to 10 ms and the stimulus duration to 0.5 ms.

Find and report the threshold, i.e. the lowest strength of the stimulus that results in an action potential for durations of 0.1 ms, 0.25 ms, 0.5 ms, and 3ms.