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: arFiniteDifferences.m
    path of file: ./repos/d2d/arFramework3/Development
    
    the code of the file until where you have to start completion: % function arFiniteDifferences(dp)
%
% Calculate sensitivities for fitting by finite difference and store them
% in the field ar.model(jm).(condition/data)(jc/jd).s(x/u/v/y)ExpSimu.
%
% arFiniteDifferences(dp)    
%   dp:     parameter variation to use      [1e-3]

function arFiniteDifferences(dp)
    
function arFiniteDifferences(dp)
%
% Calculate sensitivities for fitting by finite difference and store them
% in the field ar.model(jm).(condition/data)(jc/jd).s(x/u/v/y)ExpSimu.
%
% arFiniteDifferences(dp)    
%   dp:     parameter variation to use      [1e-3]

function arFiniteDifferences(dp)

global ar

if(isempty(ar))
    error('please initialize by arInit')
end

if(~exist('dp', 'var'))
    dp = 1e-3;
end

if(~isfield(ar.config,'useFitErrorMatrix'))
    ar.config.useFitErrorMatrix = false;
end

arPush( 'Finite Differences' );
try
    pRef = ar.p;
    arCalcMerit(false,[]);

    ar.sresFD = ar.res' * ones(1,length(pRef)) + 0;
    if ( ~isempty( ar.constr ) )
        ar.sconstrFD = ar.constr' * ones(1,length(pRef)) + 0;
    end

    arWaitbar(0);
    for jp=1:length(ar.pLabel)
        arWaitbar(jp, length(ar.pLabel));
        for jm=1:length(ar.model)
            for jc=1:length(ar.model(jm).condition)
                if(jp==1)
                    ar.model(jm).condition(jc).suExpSimuFD = zeros(size(ar.model(jm).condition(jc).suExpSimu));
                    ar.model(jm).condition(jc).sxExpSimuFD = zeros(size(ar.model(jm).condition(jc).sxExpSimu));
                    ar.model(jm).condition(jc).szExpSimuFD = zeros(size(ar.model(jm).condition(jc).szExpSimu));
                end