-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdaem_fit.m
28 lines (26 loc) · 940 Bytes
/
daem_fit.m
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
function [x,fval,exitflag,output] = daem_fit(y, T, x0, beta, k0, option, order)
lb = zeros(1,3*order-1);
ub = ones(1, 3*order-1);
for i = 1:order
lb(2*i-1) = 50;
lb(2*i) = 0.001;
ub(2*i-1) = 350;
ub(2*i) = 50;
end
A = [];
b = [];
Aeq = [];
beq = [];
nonlcon = [];
options = optimoptions('patternsearch','MaxIterations', 1e6, ...
'FunctionTolerance', 1e-8, 'MeshTolerance',1e-8);
if option == 0
[x,fval,exitflag,output] = patternsearch(@(x) ...
daem_object(x, y, T, beta, k0, option) , ...
x0,A,b,Aeq,beq,lb,ub, nonlcon, options);
else
[x,fval,exitflag,output] = patternsearch(@(x) ...
daem_object(x, y, T, beta, k0, option,order) , ...
x0, A,b,Aeq,beq,lb,ub, nonlcon, options);
end
end