MATLAB: How to use multistart with ‘fit’ function

curve fittingglobal solutionlocal minimamultistartOptimization Toolbox

Hi There,
i want to use 'Multistart' to find the best solution for a bi-exponential decay function that i am fitting to my data with bounds.
Below is the code i am using.
% bi-exponential decay model
fparam = fittype(@(a,b,c,d,x)(a)*exp(-(1/b)*x)+abs(1-a)*(exp(-(1/c)*x))+d);
lb1 = [0,0,0,0];
ub1 = [1,30,200,80];
b0 = [0.3,0.2,20,10];
x = [3.39,8.59,13.8,19,24.2,29.4,34.6,39.81,45.0,50.21];
y = [1,0.2905,0.0894,0.0838,0.1173,0.1006,0.0782,0.0894,0.1061,0.0726]
opts = fitoptions('Display','Off','Method','NonlinearLeastSquares','Normalize','Off',...
'Startpoint',b0, 'Robust','On','Lower',lb1,'Upper',ub1,...
'TolFun',1e-3);
[estTmp,Goft,Out] = fit(x,y,fparam,opts);
Since i need to start somewhere i have randomly chosen 'b0' values. I want to avoid local minima, so i want to use 'Multistart' function for optimization and find the best solution within the 'bounds' (here given by 'lb1', 'ub1').
Can someone please help me bridge 'Multistart' with 'fit' ?
P.S. I know someone might suggest to use 'lsqnonlin' instead of 'fit'. The reason i am not using it is becasue i need the output 'stats' (e.g. goodness of fit and R^2 values) which i might have to compute manually in 'lsqnonlin'. So please suggest me only the ways to combine 'Multistart' and 'fit'

Best Answer

As documented, the only local solvers available for MultiStart are fmincon, fminunc, lsqcurvefit, and lsqnonlin. Sorry, no other local solvers are supported.
Alan Weiss
MATLAB mathematical toolbox documentation