フィルターのクリア

How can the least square optimizer LSQNONLIN be well conditiond?

5 ビュー (過去 30 日間)
Miro
Miro 2012 年 7 月 12 日
Hi,
i am doing a least square optimasation with LSQNONLIN. The problem is that at a certain point I always get comlex values as result. This is coming from my logarithlc function. So my question is: is it possible to restrict the used parameters to positive values? my code looks sth like this:
options = optimset('MaxIter',10000,'MaxFunEvals',50000,'FunValCheck','on','Algorithm',{'levenberg-marquardt',.005});
alfaZ = lsqnonlin(@myfun,fgalfa1,1e-7,1e-3,options);
function f = myfun(alfa)
global LR Stmp H;
f=Stmp(:)-log(LR*alfa(:))+H*alfa(:);
end
I already tried around with the options, but it didnt change anything yet. So the problem is that LSQNONLIN tries also negative values for alfa... If anybody has an idea how to overcome this problem, it would be great. Thanks for your help!

採用された回答

Alan Weiss
Alan Weiss 2012 年 7 月 13 日
I suggest you use the lsqnonlin trust-region-reflective algorithm. As explained here, this algorithm satisfies bounds at every iteration.
It is also possible you should scale your problem so that your range of possible values is larger.
It appears that you have a 1-D problem (scalar alfa). If so, why not use fminbnd to minimize the sum of squares?
If your problem is not scalar, then you need to set vector values for your bounds. See Bound Constraints.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 件のコメント
Alan Weiss
Alan Weiss 2012 年 7 月 13 日
One other thing I forgot to say. The levenberg-marquardt algorithm does not accept bound constraints, so there is no point specifying this algorithm when you give bounds--lsqnonlin switches to trust-region-reflective anyway.
Alan Weiss
MATLAB mathematical toolbox documentation
Miro
Miro 2012 年 7 月 16 日
thanks on the detailed answer. I tried to use fminsearch, which didnt work and then directly switched to sqnonlin because it was suggested mani times. I didnk know fminbnd is also sufficient. I thought that the trust-region-relective was the default method because its stated like this in the description, so i didnt try to specify it. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by