fmincon "matrix dimensions must agree" error

5 次查看(过去 30 天)
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 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by