You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: spm_sigmoid_demo.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8/toolbox/Neural_Models
    
    the code of the file until where you have to start completion: % Demo routine for neural mass models and the activation function
% %========================================================================
% 
% This demo looks at the role of the sigmoid activation function in shaping
% the impulse response of a neural-mass model. It uses Volterra kernels and
% transfer functions and their dependency on the slope parameter of the
% activation function; It is based on the paper by Marreiros et al :
% 
% Population dynamics: variance and the sigmoid activation function
% 
% André C. Marreiros, Jean Daunizeau, Stefan J. Kiebel, Karl J. Friston
% 
% Wellcome Trust Centre for Neuroimaging, University College London, United
% Kingdom 
%
% Abstract
% 
% This paper demonstrates how the sigmoid activation function in
% neural-mass models can be understood in terms of the variance or
% dispersion of neuronal states.  We use this relationship to estimate the
% probabili
    
function
% %========================================================================
% 
% This demo looks at the role of the sigmoid activation function in shaping
% the impulse response of a neural-mass model. It uses Volterra kernels and
% transfer functions and their dependency on the slope parameter of the
% activation function; It is based on the paper by Marreiros et al :
% 
% Population dynamics: variance and the sigmoid activation function
% 
% André C. Marreiros, Jean Daunizeau, Stefan J. Kiebel, Karl J. Friston
% 
% Wellcome Trust Centre for Neuroimaging, University College London, United
% Kingdom 
%
% Abstract
% 
% This paper demonstrates how the sigmoid activation function in
% neural-mass models can be understood in terms of the variance or
% dispersion of neuronal states.  We use this relationship to estimate the
% probability density on hidden neuronal states, using non-invasive
% electrophysiological (EEG) measures and dynamic casual modelling.  The
% importance of implicit variance in neuronal states for neural-mass models
% of cortical dynamics is illustrated using both synthetic data and real
% EEG measurement of sensory evoked responses.
% 
%________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
 
% Karl Friston
% $Id: spm_sigmoid_demo.m 2393 2008-10-23 14:58:50Z karl $ 
 
clear
 
% relating R amd the variance
%==========================================================================
r     = [1:32]/8;
w     = 0;
X     = -64:1/32:64;
for i = 1:length(r)
    dSdx  = (r(i)*exp(-r(i)*(X - w))./(1 + exp(-r(i)*(X - w))).^2);
    dSdx  = dSdx/sum(dSdx);
    V(i)  = sum(X.^2.*dSdx);
end