non linear curve fitting with globaloptimization options
Ältere Kommentare anzeigen
Dear all,
i am struggling with an optimization of a non linear function with upper and lower bounds. I have been using lower and upper bounds but i have noted that the quality of the fit changes by slightly changing the value of the upper bound: in particular, if i increase a bit the upper bound the fit does not work properly, as if it was uncapable of reaching the minimum. Can anyone help me fixing the problem? Below you can find the code and attached all the data and ancillary m-files i am using. I don't understand if the problem is the algorithm itself (i.e. fmincon is not robust enough) or something else.
close all
clear
r=[-13.3001 916.6485 296.6287];
load 'tau_cryst_67_updated.txt'%data at T>Tg
data3=tau_cryst_67_updated;
T_cr=data3(:,1);
tau_67=data3(:,5);
load 'Gibbs_interpolated.txt'
Th=Gibbs_interpolated(:,1);
G=Gibbs_interpolated(:,2);
DG=interp1(Th,G,T_cr);
adjust_S
tau_67_inv=1./tau_67;
B=r(2); T0=r(3);
DH=36.04*1e3; R=8.314; Kb=1.38*1e-23; Vm=281.3/(1.3*1e6);%in m^3/mol
t_ind=@(p,T_cr) (1/p(1)*1./(10^(r(1))*10.^((r(2)/2.303)./(T_cr-r(3)))).^(p(3)).*exp(-p(2).*(T_cr.*DS).^3./(DG.^2*R.*T_cr)));
p0=[10^6,1,.5];
lb=[10^3,0,.4];
ub=[10^7,10,1];
fun_tind=@(p) norm((tau_67_inv)-(t_ind(p,T_cr)));
opts = optimoptions(@fmincon,Algorithm="interior-point");
problem = createOptimProblem('fmincon', 'x0',p0,'objective',fun_tind,'lb',lb,'ub',ub,options=opts);
ms = MultiStart('FunctionTolerance',1e-11,'UseParallel',true)
gs = GlobalSearch(ms,'PlotFcns',@gsplotbestf);
[p] = run(gs,problem)
close
figure(2)
plot(log10(tau_67_inv),T_cr,'o')
hold on
plot(log10(t_ind(p,T_cr)),T_cr)
xlabel('log_{10}(t [sec])','FontSize',12)
ylabel('T (K)','FontSize',12)
legend('exp data','my fit','FontSize',14,'Location','southwest')
legend('boxoff')
title('Analysis of Indoprofen ABOVE Tg')
Thanks to all!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Quadratic Programming and Cone Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!