MATLAB: How to use fmincon when beq is unknown in constraint Aeqx=beq

unknowns in constraint

I want to use the fmincon function, but my x as well as b is unknown. How do I solve this for the following small example: original xo-value: xo=[47; 80; 91; 138] This is a vector and not a matrix Aeq=[1 1 1 1] beq=sum(xo,1]
As is shown above, the beq depends on xo… How do I solve this problem?

Best Answer

A_eq*x gives sum(x,1). What you need to specify in beq is a certain numerical value for this sum (e.g. 5). Otherwise the relation A_eq*x=beq reads sum(x,1)=sum(x,1) which is always true and no constraint on x.
Or do you try to specify sum(x,1)=sum(xo,1) ? Then A_eq=[1 1 1 1] and beq=47+ 80+ 91+ 138.
Best wishes
Torsten.