Error with lsqnonlin : Error in lsqncommon (line 14) if any(~isfin​ite(initVa​ls.F))

6 ビュー (過去 30 日間)
Franck Farail
Franck Farail 2021 年 4 月 6 日
コメント済み: Alan Weiss 2021 年 7 月 27 日
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

採用された回答

Alan Weiss
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
Franck Farail 2021 年 7 月 26 日
Hello everybody,
So I ckecked my programm and I don't understand : I checked my initials values to see if they are finite and they are finite and then wenn I put these values in the lsqnonlin function, I have the same error.
TF =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1 Finite value
Check for missing argument or incorrect argument data type in call to function 'isfinite'.
Error in lsqncommon (line 14)
if any(~isfinite(initVals.F))
  5 件のコメント
Franck Farail
Franck Farail 2021 年 7 月 27 日
Okay so I evaluate the function
fonction_erreur(x0)
I changed some things and now I have this error message
Unable to perform assignment because brace indexing is not supported for variables of this type.
Error in fonction_erreur (line 20)
erreur_pose{j,1} = Pos_M{j,1} - Pos_F{j,1};
Error in Etalonnage_robot_6R (line 201)
fonction_erreur(DHM_e);
Here is my function :
function erreur = fonction_erreur(dhm_e)
global Routil Poutil Pos_F Pos_M j;
erreur_pose = zeros(100,100);
T06_e = calc_mgd(dhm_e);
disp('T06_e =');
disp(T06_e);
%Tb = matrice_passage_instrument(DHMolt1);
To = matrice_passage_outil_cas_2(Routil,Poutil);
Pos_M{j,1} = T06_e*To; %Tb
disp('Pos_M =');
disp(Pos_M);
erreur_pose{j,1} = Pos_M{j,1} - Pos_F{j,1};
save erreur_de_positions erreur_pose
save positions_finales_mesurées Pos_M
erreur = erreur_pose;
end
Alan Weiss
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

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

カテゴリ

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