from
Neurocal
by Zeng Lertmanorat Simulation describing the electrical activity of nerve cell (neuron) by solving cable equation
[Amplitude]=Isin(t)
function [Amplitude]=Isin(t)
global HFblock
%Input
% t (us)
%Output
% Amplitude (uA)
% setting the Amplitude to empty indicates the end of the stimulus
% pulse. This helps speed up the calculation
%--------------------------------------------------------------------------
Delay = 0;
Dur = 40000; %us
freq = HFblock.freq; %Hz
Amp = 1; %uA %for Iexstim
%--------------------------------------------------------------------------
if t<Delay
Amplitude=0;
elseif t < (Delay+Dur)
Amplitude=Amp*sin(2*pi*freq*t/1000000);
else
Amplitude=[];
end