Bad results of lsqnonlin
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everybody, I have to solve a 2 non-linear equations system with bounds(upper and lower) I tried lsqnonlin and sometimes it didn't converge to the right answer and i don't understand why!
***A simplified version of the problem (linear and deterministic):
options=optimset('Display','off','MaxIter',1000,'TolFun',1e-009,'TolX',1e-009);
lb = [0,0]; ub = [13.33,6.66]; x0 = [0;0];
xRes = lsqnonlin(@(x)OptimalStrategy2(x,30,1,10,8),q0,lb,ub,options);
***The defined function is the following:
function y = OptimalStrategy2(x,a,b,c1,c2)
y = [a-b*x(2)-c1-2*b*x(1);
a-b*x(1)-c2-2*b*x(2)];
end
*****by running the code I get xRes = 7.0720 6.6600 which is incorrect I'm supposed to get xRes = 6.6600 6.6600 to have both equations satisfied (i.e a-b*x(2)-c1-2*b*x(1)=0 and a-b*x(1)-c2-2*b*x(2)=0)
I need your help to undertand this point please!
0 Kommentare
Akzeptierte Antwort
Matt J
am 30 Sep. 2014
Bearbeitet: Matt J
am 30 Sep. 2014
I'm supposed to get xRes = 6.6600 6.6600 to have both equations satisfied
By direct inspection, I find that xRes = [6.6600 6.6600] does not satisfy your equations. Neither does xRes = [7.0720 6.6600], but it is better in a least squares sense:
K>> f=@(x) OptimalStrategy2(x,30,1,10,8);
K>> norm(f([6.66,6.66]))
ans =
2.0201
K>> norm(f([ 7.0720 6.6600]))
ans =
1.7978
Incidentally, your problem is linear, so you should probably be using LSQLIN.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Gaussian Process Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!