function[sum_num] = num2(x, vl, spikepos) x_p = repmat(x,length(spikepos),1); d = vecnorm(x_p-spikepos, 2, 2); D = 1.5*vl; result = exp(-0.5*d(d<D)/vl); sum_num = sum(result);