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: ADEM_cost.m
    path of file: ./repos/spm12/toolbox/DEM
    
    the code of the file until where you have to start completion: % This demo re-visits the mountain car problem to show that adaptive
% (desired) behaviour can be prescri
    
function (see spm_mc_fx_4.m)
%--------------------------------------------------------------------------
subplot(2,1,2)
x     = -2:1/64:2;
d     =  0:1/64:2;
for i = 1:length(x)
    for j = 1:length(d)
        D      = spm_phi((1 - d(j))*8);
        A      = 2 - 32*exp(-(x(i) - 1).^2*32);
        C(i,j) = A*D - 1;
    end