BioNB 442: Lab 2

Introduction to Matlab.

Introduction.

This assignment will introduce you to the lab environment we will use this semester. We will be using Matlab as a computational language. MatLab is a general-purpose scientific computing language. We will use it in many ways in this course, but for this lab, we will do calculations and make plots of data.


Procedure:

Make yourself a folder in the directory c:\My documents\. Put all files which you may generate or download into the folder you make. You will share the account with the other students in 442.

Download the contents of Voltage12Aug2000.mat by right-clicking on the link and choosing the Save Link As... option. Be sure to save it in your own folder. This is a data file.

Download this AP.MAT containing a few seconds of extracellular recordings from the midbrain of a fish. The file has voltage readings taken at a rate of 10000/sec for 5 seconds. Plotting the data file should convince you that the signal-to-noise ratio is good enough to identify action potentials by an amplitude threshold.

The following code moves a dot around a circle. You will need this for part of the assignment below.

figure(1)
clf
set(gcf,'doublebuffer','on')

%draw a circle
t=0:.01:2*pi;
x = cos(t);
y = sin(t);
plot(x,y)
hold on
%draw one dot
dotH = plot(x(1),y(1),'ro')

%move the dot
for i=1:length(x)
    set(dotH, 'xdata',x(i), 'ydata',y(i) )
    drawnow
end

Assignment

  1. The data file Voltage12Aug2000.mat contains two vectors: time and voltage. Using the Matlab command:
    load c:\yourpath\Voltage12Aug2000 t v ;
    you can read the file contents into the vector variables t and v. The phrase 'yourpath' above represents the path of file folders in which which you stored your copy of the file. If I were writing the command, I would write
    load 'c:\my documents\bruce\Voltage12Aug2000' t v ;
    Plot the variables as v versus t and answer the questions below. Using tools from the matlab figure Insert menu, place arrows pointing to threshold and maximum undershoot, then label them with text.
  2. Take the derivitive of v with respect to t (use diff function), then plot dv/dt versus t.
  3. Now plot dv/dt versus v. On the plot of dv/dt versus v, use the Matlab arrow tool to draw an arrow indicating threshold.
  4. On the dv/dt versus v plot, make a moving red dot which follows the time evolution of the curve. Make the dot move no faster than 20 frames/sec.
  5. Write a program to determine when action potentials occur in the file AP.MAT which you downloaded, and then produce a histogram of the inter-spike intervals (ISI). Use the command load c:\yourpath\ap wave ; to load the data. Use help hist to see how to make a histogram. Estimate the average frequency of firing.

Your written lab report should include:

  1. Your analysis of the Voltage12Aug2000 data including:
    1. Listings of each program you wrote.
    2. The plots you made, with the axes labeled and with a title.
    3. A description of what you think the contents of Voltage12Aug2000.mat represent.
    4. The likely units of the vertical and horizontal axes on the v versus t plot.
    5. The peak of the dv/dt versus t plot represents the maximum current. At what voltage does this occur?
  2. The histogram and estiamte of average firing frequency from item 5 above

June 2007 Copyright Cornell university