iz_threshold_fun.m

来自「bnn神经网络」· M 代码 · 共 43 行

M
43 行
字号
function [value , isterminal , direction] = iz_threshold_fun(t , y)
% IZ_THRESHOLD_FUN     Threshold function for Izhikevich model
% 
%   Version:    1.0
%   ----------------------------------
%   Amir Reza Saffari Azar, August 2004
%   amir@ymer.org
%   http://www.ymer.org
%   http://ee.sut.ac.ir/faculty/saffari/main.index

global net

state_num   = net.Neurons.Model.StateNum;

%---setting parameters
if ischar(net.Neurons.SpikeDet.SpikeDetFunParam)
    switch lower(net.Neurons.SpikeDet.SpikeDetFunParam)
        case 'def'
            threshold   = 30*ones(net.Architecture.NeuronNum , 1);
        otherwise
            error('Unknown threshold parameters')
    end
else
    if length(net.Neurons.SpikeDet.SpikeDetFunParam) == 1
        threshold   = net.Neurons.SpikeDet.SpikeDetFunParam*ones(net.Architecture.NeuronNum , 1);
    elseif length(y) ~= state_num*length(net.Neurons.SpikeDet.SpikeDetFunParam)
        error('Threshold vector size does not match with the number of neurons')
    else
        threshold   = net.Neurons.SpikeDet.SpikeDetFunParam;
    end
end

%---checking for threshold crossing
y2check     = y(1:state_num:end);
value2check = y2check - threshold;

value                   = ones(size(y));
value(1:state_num:end)  = value2check;

isterminal  = ones(size(y));
direction   = ones(size(y));

return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?