2010/spike10: logneuron.m

File logneuron.m, 0.9 KB (added by jtapson, 8 years ago)

Matlab file for logarithmic neuron

Line 
1n=1e6;
2threshold = 1;      % membrane voltage threshold
3init_syn_tfr = 0.25;        % initial synaptic transfer function
4syn_tfr = init_syn_tfr;     % running synaptic transfer
5                    % assumes spike amplitude  = 1
6                    % in input series
7drift = 0.005;      % postive membrane drift
8noise = 0.005;      % noise variance
9
10v = 0;              % reset value of neuron
11
12for t=1:n
13    v = v + drift + randn()*noise + input(t,1)*syn_tfr;  % update membrane
14                        % if input spike, adjust synaptic strength
15    syn_tfr = syn_tfr*(1 - input(t,1)*0.2);
16    if (v > threshold)  % if output spike
17        output(t,1)=1;   
18        v = 0;          % reset membrane
19        syn_tfr = syn_tfr*0.5;  % halve synaptic strength
20    end
21    % gradually restore initial synaptic strength
22    syn_tfr = 0.9975*syn_tfr + 0.0025*init_syn_tfr;
23end
24 
25