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: demo_CaBBI_QGIF.m
    path of file: ./repos/VBA-toolbox/demos/4_neural
    
    the code of the file until where you have to start completion: % This script inverts the QGIF model for the given fluorescence trace using
% CaBBI method: [ Rahmati. et al. 2016, PLoS Comput Biol 12(2) ]
%
% To user:
% I) in Step 1, determine the directory to the fluorescence trace (a real row vector);
%    as default the code will download and use our published data for CaBBI 
% II) in Step 2, determine the sampling rate (Hz) used for recording the fluorescence trace
% III) run the code
% IV) the main outputs of the CaBBI are listed in Step 11. 
%
% Further options:
% 1) In Step 10, if necessary, you can change the spike-detection threshold which is used to extract 
%    spike-times from inferred voltage traces. Such change may increase the spike-detection accuracy. 
% 2) In Step 6, if necessary, you can change some internal parameters of the optimization process.
% 3) For further description of the toolbox options, please see:
%    http://mbb-team.github.io/VBA-toolbox/wiki/Controlling-the-inversion-using-VBA-options/
%    http://mbb-team.github.io/VBA-toolbox/wiki/VBA-output-structure/


clear all; close all

%% Step 1. Importing the fluorescence trace
% import the fluorescence trace
dataFolder = [pwd filesep 'Data' filesep];
addpath('dataFolder'); 
Fluor_trace_name = 'fluorescence_data8';                                   % file name of the fluorescence trace
Fluor_trace_dir = [dataFolder,Fluor_trace_name,'.mat'];
 
if exist(Fluor_trace_dir,'file') == 0                                      % check whether the fluorescence data have been already downloaded
    url = 'https://github.com/VahidRahmati/Sample_Data/blob/master/Sample_Data.zip?raw=true';

    
function
g_fname = @g_CaBBI;                                                        % observation function

% setting the parameters of the QGIF model used for inversion
nFrames = numel(Fluor_trace);                                              % number of recording frames
dt = 0.2;                                                                  % [ms], time-step size of the QGIF model
inF.dt = dt; 
inF.k_Ca0 = 0.002;                                                         % scale parameter of [Ca2+] kinetics
TauCa_realTime = 7500;                                                     % [ms], the prior for decay time-constant of calcium transients in real time
dt_real = 1000/sampling_rate;                                              % [ms], frame duration (temporal precision) of fluorescence data
inF.Tau_Ca0 = TauCa_realTime*dt/dt_real;                                   % efective prior mean for tau_Ca in inversion; see Eqn. 17
inG.k_F0 = 5;                                                              % scale parameter of the fluorescence observations
inG.ind = 2;                                                               % index of [Ca2+] variable


%% Step 6. Setting the internal parameters of the optimization (VB-Laplace) method
options.backwardLag = 2;                                                   % lag parameter (selcet either 2 or 3); increasing it e.g. to 3 (or higher) "may" provide more accurate inversions 
options.updateHP    = 1;                                                   % this allows the precison (hyper) parameters to be learnt from data
options.MaxIterInit = 0;  
options.MaxIter     = 2;  % or e.g. 3                                      % maximum number of optimization iterations; increasing it will lead to a  
                                                                           % complete optimization process, although it may take long time to be converged)
                                                                           
options.DisplayWin  = 0;                                                   % set to zero to speed up the inversion
options.verbose     = 1;                                                   % set to zero to speed up the inversion
options.decim       = 1;                                                   % this determine the micro-time resolution; increasing it e.g. to 2 (or higher) "may" provide more accurate inversions


%% Step 7. Assigning the prior densities: (mu --> mean), (Sigma --> variance)
% prior densities for initial conditions 
priors.muX0         = [ -63.62; 5.65];                                     % [V(0), [Ca2+](0)]
priors.SigmaX0(1,1) = 100;
priors.SigmaX0(2,2) = 25;

% prior densities for evolution parameters
priors.muTheta         = [0; 0; 0]; 
priors.SigmaTheta(1,1) = 5;                                                % for X_Tau_Ca
priors.SigmaTheta(2,2) = 100;                                              % for Ca_base 
priors.SigmaTheta(3,3) = 5;                                                % for X_k_Ca

% prior densities for observation parameters
priors.muPhi         = [min(Fluor_trace)/2; 0]; 
priors.SigmaPhi(1,1) = 0.25;                                               % for d_F
priors.SigmaPhi(2,2) = 1;                                                  % for X_k_F 

% prior densities for precision parameters: Gamma distributions
priors.a_alpha = 1e0;
priors.b_alpha = 1e0;
priors.a_sigma = 1e0;
priors.b_sigma = 1e0;

% building the precision matrix for evolution variables
 priors.iQx = cell(nFrames,1);
for t = 1:nFrames 
    dq(1)           = 5e-3;                                                % on V 
    dq(2)           = 10;                                                  % on [Ca2+]
    priors.iQx{t}   = diag(dq);
end