Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: fmincon with bounds results solution outside the bounds!
Replies: 1   Last Post: Feb 22, 2011 12:02 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Hanan Shteingart

Posts: 4
Registered: 6/25/09
fmincon with bounds results solution outside the bounds!
Posted: Feb 22, 2011 11:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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',
'interior-point'));

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?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.