Lsqcurvefit - different optimal values for different starting values ??

2 views (last 30 days)
Hi, I have a problem with the optimization by lsqcurvefit function. Briefly, I have a symbolic function which it is a vector contains symbolic elements. Each element contains the desired parameter I would like to optimize. In addition I have an experimental data vector of the same length as the function vector. I tried to optimize the function vector with the experimental data, but when I define different starting values in lsqcurvefit function I get different optimal values to the desired parameters. Someone knows what could be the problem ? Thanks!!
  1 Comment
Avihai Goldfarb
Avihai Goldfarb on 7 Sep 2015
Edited: the cyclist on 7 Sep 2015
Below I attached the code:
P and T are symbolic variables.
The symbolic Function Vector:
AnalyticalConc = [3/8 - (3*exp(P*(1/(2*T) - 1)))/8 ;
exp(P*(1/(2*T) - 1))/32 - (3*exp(2*P*(1/(2*T) - 1)))/8 + 11/32 ;
(11*exp(P*(1/(2*T) - 1)))/384 + exp(2*P*(1/(2*T) - 1))/32 - (3*exp(3*P*(1/(2*T) - 1)))/8 + 121/384 ;
...
]'
(note: I didn't write all the elements! there are three symbolic element more - total six elements).
time = [1 2 3 4 5 6];
The experimental data = [0.039 0.059 0.062 0.072 0.069 0.068]; Now I would like to optimizae the parameters P and T, hence:
x0 = [0.1, 6]; %%[P T] initial values
[solution,resnorm,residual,exitflag] = lsqcurvefit(@fun,x0,time,ExperimentalConc);
function F = fun(x,xdata)
syms P T
load('AnalyticalConc.mat');
time=1:6;
ind=find(time==xdata);
F = double(subs(AnalyticalConc(ind),[P,T],[x(1),x(2)]));
end
In the case that I change the initial values to [0.02 9], for example, the optimal parameters also change!

Sign in to comment.

Answers (1)

Matt J
Matt J on 7 Sep 2015
Edited: Matt J on 7 Sep 2015
I would guess that you have infinite solutions and that it is because your function depends on P and T entirely through the expression
P*(1/(2*T) - 1)
Therefore, if P0 and T0 are a fixed pair of optimal parameters, then any additional P,T satisfying
P*(1/(2*T) - 1) = P0*(1/(2*T0) - 1)
will also be optimal. The equation above is satisfied by an infinite locus of (P,T).
  1 Comment
Greig
Greig on 7 Sep 2015
Since it is only a 2D problem, it might be worth doing some number crunching over a small, but reasonable range of P and T values and contouring the function to see the pattern.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!