fmincon - error message "Row dimension of Aeq is inconsistent with length of beq."?

4 views (last 30 days)
Hello ,
I am trying to use the fmincon but am constantly getting the following error message.What do you suggest me to change? Thanks in advance.
F_1 = [3.5,4];
F_2 = [2.5,3];
F_3 = [3,4];
a_1 = [40,45];
a_2 = [50,55];
a_3 = [55,60];
fun =((2.*F_2.*(F_1+F_2-F_2)+a_3.*(3.*F_2+F_2-F_1)+F_1.*(F_2+F_1-F_2)/(3.*F_1+2.*F_2+a_3)));
Here is the problem:
x = fmincon(fun,F_1,F_2,F_3,a_1,a_2,a_3)
Error using fmincon (line 287)
Row dimension of Aeq is inconsistent with length of beq.

Answers (1)

Walter Roberson
Walter Roberson on 2 Feb 2016
Note: your "fun" is a numeric matrix, not a function. All of the variables in "fun" have been defined as constants. There is nothing to optimize.
Also notice that you define a_1 and a_2 but you do not use them in fun

Tags

Community Treasure Hunt

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

Start Hunting!