
fmincon with bounds results solution outside the bounds!
Posted:
Feb 22, 2011 11:36 AM


hello, I need to find a positive solution (e.g. x>0) which sums to 1 (sum(x)=1) but if I put lb=0 I still get negative solutions...
X = % load P*N data N = size(X,2); W0 = 1/N*ones(N,1);
A = []; b = []; Aeq = ones(1,N); beq =1; lb = 0; ub = inf; mycon = [];
W = fmincon(@(W)myfun(W,X),W0,A,b,Aeq,beq,lb,ub,mycon,optimset('Algorithm', 'interiorpoint'));
Result:
W =
1.1876 0.1269 1.9361 5.1877 > negative! 5.7522 1.6872 0.6485 1.7252 5.6637 3.3205 1.1855 1.5645 5.4133 8.4845 1.7869
What's wrong?

