%script to run simulations for FE model
clear all
tic
ML = 0;
delete(gcp('nocreate'))
parpool('local',4);
spmd
    rng(0,'combRecursive');
end

path = '../data/simulationdata/FE';
if exist(path)==0
   mkdir(path) ;
end

c=linspace(0.01,0.05,5);
d=[0.0015 0.009 0.0169 0.025 0.04];

if ML ==1 % run maximum likelihood value
c=c(2);
d=d(3);
end

e=1;
L1=0.9;
L2=0.9;
Lapse=0;

run=1;
for i= 1:length(c)
    answer2D= robModel(c(i),e,L1, L2,Lapse ,3);
    for j=1:length(d)
    answer3D= robModel3D(c(i),d(j),e,L1, L2,Lapse ,3);
    C=c(i);
    D=d(j);
    save([path,'/fitFE_',num2str(run),'.mat'])
    disp(run)
    run=run+1;
end
end
