function [sum_den]=den(x,vl,table)   %%denominator of firing rate formula
    sum_den=0;
    for i=1:length(table)
        
     
        sum_den=sum_den+gaussian(norm(table(i,:)-x),vl);
    end
end

function [result]=gaussian(x,vl) %truncated gaussian
     
     d=1.5*vl; %distance threshold beyond which is zero
     
     std=vl;
     
    
     if x<d
        
         exponent=(-0.5 * x)/std; %gaussian value 0 after distance d=1.5 voxels
         
         result=exp(exponent);
       
         
         
     else
         result=0;
     end
end