Error with lsqnonlin : Error in lsqncommon (line 14) if any(~isfinite(initVals.F))
6 ビュー (過去 30 日間)
古いコメントを表示
Hello everybody,
I have a question : when I run my programm, I have an error in lsqncommon. So I went in this function to understand my error and the programm stop at this line of the function lsqncommon :
if any(~isfinite(initVals.F))
error(message('optimlib:commonMsgs:UsrObjUndefAtX0', caller));
end
But I don't understand the meaning of this line, is there someone who can explain me this line please ?
Thanks !
Franck
0 件のコメント
採用された回答
Alan Weiss
2021 年 4 月 6 日
Apparently, some initial values are not finite. You gave a value of x0 so that your objective function evaluated at x0 gives some NaN or Inf value. The solver cannot proceed from such a point.
Alan Weiss
MATLAB mathematical toolbox documentation
その他の回答 (1 件)
Franck Farail
2021 年 7 月 26 日
5 件のコメント
Alan Weiss
2021 年 7 月 27 日
It looks like you are mixing up cell arrays and matrices. This line creates a matrix:
erreur_pose = zeros(100,100);
Then you try to refer to it using cell array indexing:
erreur_pose{j,1} = Pos_M{j,1} - Pos_F{j,1};
I don't know what type of variable Pos_M is (or Pos_F either), whether it is a matrix or a cell array. Assuming that it is a matrix, you should write
erreur_pose(j,1) = Pos_M(j,1) - Pos_F(j,1);
Then again, I don't see a loop here defining the indices j and i. Nor do I see a need for any such indices. Maybe you shoud write
erreur_pose = Pos_M - Pos_F;
I really cannot understand your function, either what it is or what it is trying to accomplish. But this indexing suggestion should help.
Alan Weiss
MATLAB mathematical toolbox documentation
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!