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: DEM_demo_hdm_LAP.m
    path of file: ./repos/spm12/toolbox/DEM
    
    the code of the file until where you have to start completion: function DEM_demo_hdm_LAP
% Demo for Hemodynamic deconvolution: Cross-validation of Laplace scheme
%__________________________________________________________________________
% This demonstration compares generalised filtering and DEM in the context
% of a nonlinear convolution model using empirical data. These are the data
% used to illustrate hemodynamic deconvolution. We have deliberately made
% the problem difficult here to highlight the ability of Generalised
% filtering to accumulate evidence to optimise in parameters and hyper-
% parameters, which allows it to outperform DEM (although it does not
% find visual motion effects with 90% confidence)
%__________________________________________________________________________
% Copyright (C) 2010 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: DEM_demo_hdm_LAP.m 4804 2012-07-26 13:14:18Z karl $

% set-up
%--------------------------------------------------------------------------
global dt

spm_figure('GetWin','DEM');
load HDM

% generative [likelihood] model 'HDM'
%==========================================================================
dt      = Y.dt;
T       = 1:256;

% level 1
%--------------------------------------------------------------------------
[pE pC] = spm_hdm_priors(3,2);
M(1).x  = [0 0 0 0]';
M(1).g  = 'spm_gx_hdm';
M(1).f  = 'spm_fx_hdm';
M(1).pE = pE;
M(1).pC = pC;
M(1).W  = exp(8);
M(1).V  = exp(4);

% level 2
%--------------------------------------------------------------------------
M(2).v  = [0 0 0]';
M(2).V  = exp(2);

M(1).E.linear = 1;
M(1).E.n  = 4;
M(1).E.nD = 1;
M(1).E.nE = 16;
M(1).E.nN = 16;
M(1).E.s  = 1/2;

% Decimate U.u from micro-time
% -------------------------------------------------------------------------

    
function DEM_demo_hdm_LAP
% Demo for Hemodynamic deconvolution: Cross-validation of Laplace scheme
%__________________________________________________________________________
% This demonstration compares generalised filtering and DEM in the context
% of a nonlinear convolution model using empirical data. These are the data
% used to illustrate hemodynamic deconvolution. We have deliberately made
% the problem difficult here to highlight the ability of Generalised
% filtering to accumulate evidence to optimise in parameters and hyper-
% parameters, which allows it to outperform DEM (although it does not
% find visual motion effects with 90% confidence)
%__________________________________________________________________________
% Copyright (C) 2010 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: DEM_demo_hdm_LAP.m 4804 2012-07-26 13:14:18Z karl $

% set-up
%--------------------------------------------------------------------------
global dt

spm_figure('GetWin','DEM');
load HDM

% generative [likelihood] model 'HDM'
%==========================================================================
dt      = Y.dt;
T       = 1:256;

% level 1
%--------------------------------------------------------------------------
[pE pC] = spm_hdm_priors(3,2);
M(1).x  = [0 0 0 0]';
M(1).g  = 'spm_gx_hdm';
M(1).f  = 'spm_fx_hdm';
M(1).pE = pE;
M(1).pC = pC;
M(1).W  = exp(8);
M(1).V  = exp(4);

% level 2
%--------------------------------------------------------------------------
M(2).v  = [0 0 0]';
M(2).V  = exp(2);

M(1).E.linear = 1;
M(1).E.n  = 4;
M(1).E.nD = 1;
M(1).E.nE = 16;
M(1).E.nN = 16;
M(1).E.s  = 1/2;

% Decimate U.u from micro-time
% -------------------------------------------------------------------------
Dy  = spm_dctmtx(size(Y.y,1),size(Y.y,1));
Du  = spm_dctmtx(size(U.u,1),size(Y.y,1));
Dy  = Dy*sqrt(size(Y.y,1)/size(U.u,1));
u   = Dy*(Du'*U.u);
U   = spm_detrend