Deriving Max with fmincon when contraints differ
Afficher commentaires plus anciens
I am about to derive maximum values under linear contraint. Exactly describing
Target function is
function f = utility(x) f = (0.7*x(1)^2 + 0.3*x(2)^2)^0.5
And then
Aeq = [1 1]
beq = 100
So, using fmincon
[x, fval] = fmincon(@utility, x0, [], [], Aeq, beq);
I actually derived the result.
HOWEVER, what I REALLY want to do is to change Aeq = [i 1] (i=1~10) and finally get a 10*3 matrix with i and x. Thru this, I could get a plot of x(:,2) against x(:,3).
So, I used FOR such as below. (I also changed initial guessing values X()
=======================
Aeq = zeros(10,2);
Aeq(:,1) = 1:1:10;Aeq(:,2)=1;
X = zeros(10,2);
X(:,1) = 100:-8:28;X(:,2)=100:-8:28;
for i=1:10 beq = 100;
[x] = fmincon(@utility, X(i,:), [], [], Aeq(i,:), beq);
S = [Aeq(i) x];
end
==========================
Result doesn't give me what i WANT. What is wrong with these lines?
Please, help me.
Thanks in advance.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Pattern Recognition dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!