How to maximize this function: x1^2+x2^2+...+xn^2 ?

Hello
How can I maximize the function x1^2+x2^2+...+xn^2
under some constraints which are LINEAR?
Thank you very much in advance!
Alex

Réponses (2)

Sean de Wolski
Sean de Wolski le 2 Juil 2012

1 vote

fmincon

1 commentaire

Teja Muppirala
Teja Muppirala le 3 Juil 2012
Or how about QUADPROG?
H = identity matrix
f = zero vector
A,b = your linear constraints

Connectez-vous pour commenter.

Richard Brown
Richard Brown le 3 Juil 2012
Modifié(e) : Richard Brown le 3 Juil 2012
I assume you mean minimise rather than maximise, because unless you have n independent constraints, your problem is unbounded.
In this case, assuming your constraints are Ax = b, just use the QR factorisation
[Q, R] = qr(A', 0);
x = Q * (R' \ b);

1 commentaire

Richard Brown
Richard Brown le 3 Juil 2012
just reread your question - if your constraints are inequalities, quadprog is the way to go

Connectez-vous pour commenter.

Catégories

Tags

Question posée :

le 2 Juil 2012

Community Treasure Hunt

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

Start Hunting!

Translated by