fmincon "matrix dimensions must agree" error

조회 수: 2 (최근 30일)
Brandon Campanile
Brandon Campanile 2018년 11월 7일
댓글: Ankita Chadha 2021년 6월 7일
I'm not going to post the entire code, but it can be seen in this Github repo on the "optimization" branch. Run the GUI and click the "Optimize" button to get the error, or you can just read the "optimization.m" file. The exact error is below; I was hoping someone could tell me what is going on. It was working yesterday and I haven't changed much. Thank you.
Matrix dimensions must agree.
Error in finitedifferences
Error in computeFinDiffGradAndJac
Error in barrier
Error in fmincon (line 813)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in optimization (line 39)
b_min = fmincon(func, x0, A, c, Aeq, beq, lb, ub, nlc);

채택된 답변

Brandon Campanile
Brandon Campanile 2018년 11월 8일
Figured out the reason. Apparently the number of nonlinear constraints in fmincon cannot change between iterations.
  댓글 수: 2
Arthur Iasbeck
Arthur Iasbeck 2020년 5월 18일
I was facing the same problem and worked for me too. Thanks Brandon.
Ankita Chadha
Ankita Chadha 2021년 6월 7일
So how do you get rid of this error? Since it is a built in function, I am unable to debug this one.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by