Simulations

Diffusion Code

Diffusion with Membrane Code

Diffusion with Membrane and Position Code

Diffusion with charge and potential Code

# Unmyelinated and Myelinated Axons

For the unmyelinated axon, I modeled like the myelinated axon that we coded for Homework#5 in Dr. Land's section but I had the node spacing very space, approximately 0.005cm, and considered 20 nodes. For this model, the G-leak value had to increase since normally in an axon the G-leak will be lower for a myelinated axon due to all of it's sheaths compared to an unmyelinated axon. The functions starting with alpha and beta correspond to the Hodgkin-Huxley Model. Unmyelinated Axon Code and Myelinated Axon Code Click under Stimulations, on Axons to download the file to see how the code runs. Below are a few examples, notice that in the Unmyelinated axon the propagation fails and is slower than the myelinated axon.
Unmyelinated Propagation:

Unmyelinated Velocity:

Myelinated Propagation:

Myelinated Velocity:

# Diffusion

I also tried to simulate the Nernst Equilibrium. To do this I had to go through different steps to build up to writing the code. Although, these steps are useful in trying to understand how ions flow in channels. First, I wrote the code for diffusion, which is like a code for animating a random walk. For the following examples, the red molecules are Potassium, the blue are Sodium and the green are Chloride. Diffusion Function Code and Diffusion Code. Below is an example of Diffusion (requires IE).

# Diffusion through semi-permeable Membrane

Next, I had to create a semi-permeable membrane. I did this by using the rand function in Matlab. The light blue line represents the membrane. Notice that as molecules try to diffuse through (shown as molecules on the membrane) some are allowed and others are not. In this case, the Na is much more permeable through the membrane than K. Diffusion Membrane Function Code and Diffusion with Membrane Code. Below is an example of this:

# Diffusion through semi-permeable Membrane while keeping track of molecule position

The next step was to determine where the molecules were positioned, whether they were inside the cell or outside. This was done by modifying The diffusion membrane function to include position. Diffusion Membrane Function with Position Code, Diffusion Membrane Function Code. An example of the code working is below:

# Diffusion including Nernst Equation

At this point, I incorporated the Nernst Equilibrium Equation calculated for each ion, and showed this value at the bottom of the figure. Calculation of Nernst Equation with Diffusion of Ions Code Three examples are below:

# Diffusion through Semi-permeable Membrane, while tracking charge

To keep track of the charges I wrote a function and then in the code I implemented it such that after calculating the placement of charges for that ion; it would update the total positive and negative charges. Number of charges In and Out of Cell Code