-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbanditInterface.m
More file actions
32 lines (30 loc) · 928 Bytes
/
banditInterface.m
File metadata and controls
32 lines (30 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
clear classes;
ke.H = Mixer(0,1,'ke.H');
ke.Cs = Mixer(0,1,'ke.C');
ke.Cp = ke.Cs;
ke.HH = Mixer(0,1,'ke.HH');
ke.CsH = Mixer(0,1,'ke.CH');
ke.CpH = ke.CsH;
ke.CsCs = Mixer(0,1,'ke.CC');
ke.CsCp = ke.CsCs;
ke.CpCp = ke.CsCs;
en.H = Mixer(0,1,'en.H');
en.Cs = Mixer(0,1,'en.C');
en.Cp = en.Cs;
en.HH = Mixer(0,1,'en.HH');
en.CsH = Mixer(0,1,'en.CH');
en.CpH = en.CsH;
en.CsCs = Mixer(0,1,'en.CC');
en.CsCp = en.CsCs;
en.CpCp = en.CsCs;
f1 = makeFitme('h2',2:7,'enstruct',en,'kestruct',ke);
p = f1.getPars; % just getting current parameters to have correct
% length vector
a = f1.randMolError(p);
%% Traditional minimization approach
start = f1.getPars;
options = optimset('DiffMinChange',1.0e-5,'TolFun',1.0e-4,'TolX',1.0e-3);
limits = [];
[pt2,resnorm,residual,exitflag,output,lambda,jacobian] = ...
lsqnonlin(@f1.err, start,-limits,limits,options);
% pt2 is the set of parameters that minimize the energy