Hi,
I am trying to create a neuron model that fires action potentials (spikes) when a certain threshold is reached. The spikes are slowly reduced and eventually reaches noise level in the refractory period and again fires after the refractory period. The initial input is a continuous signal.
Thanks
Hi Lakshmi,
You can use events (if, when statements) to convert your continuous signal to discrete signals. A simple model that mimics the first part of your case is as follows:
model Model
Real contSignal;
Real outputSignal(start = 1);
parameter Real slope = 2;
parameter Real threshold = 5;
equation
der(contSignal) = slope;
if contSignal < threshold then
der(outputSignal) = 0;
else
der(outputSignal) = -outputSignal;
end if ;
Hi Ankit,
What does the slope do? I tried to use this code in system modeler. I used an exponential sine wave (from the modelica blocks library) as my source with an amplitude of 10. I used a slope of 2 and threshold of 5, but I get an output signal of 0 amplitude (a flat signal). Please let me know.
Thanks
Lakshmi
I think you want to do this. ‘Slope’ was just a parameter I used to define the continuous signal.
model EventGen
Modelica.Blocks.Sources.ExpSine source(amplitude = 10, freqHz = 1, damping = 1) ;
parameter Real threshold = 1;
Real outputSignal(start = 0);
equation
der(outputSignal) = -outputSignal;
when source.y < threshold then
reinit(outputSignal,1);
end when;
end EventGen;