**Neuron Firing Simulation**:

Write a function like this:

function neuron(dis, tot_time, timestep, Mean) ... endThe parameter

The parameter `tot_time` is the total time for the simulation
in milliseconds.

The parameter `timestep` is the interval between simulation
calculations in milliseconds.

The parameter `Mean` is in milliseconds when `dis` is
3 and volts otherwise. The first letter is upper case to prevent
conflict with the Matlab function called `mean`.

Write functions to set `Vcc`, `Vth`, and `ISI`
from the input parameters. For example,

function res = getVth(dis,Mean) if dis ~= 1 res = 1; else res = min(Mean,1.5)*rand(1) + 1; end endand

function res = getVcc(dis,Mean) if dis ~= 2 res = 5; else res = log(rand(1))/log(1-(1/Mean)) + 5; end endand put these functions into separate files with name prefixes that match the function names. Then the first few lines of the

RC = 70; % 70 millisecond time constant Vcc = getVcc(dis,Mean); % neuron target voltage Vth = getVth(dis,Mean); % neuron threshold voltage ISI = getISI(dis,Mean); % interspike interval in milliseconds

Let `q` be the most recent iteration on which a neuron spike
began. Then the voltage on the `i`th iteration is

Vneuron(i) = (1-exp(-timestep*(i-q)/RC))*Vcc;unless this voltage becomes greater than

Use a variable, say `p`, to record the time at which the last
peak occurred. Then the time since the last peak is

timestep*(i-p)