Proper implementation and use of fmincon
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need some guidance for this following problem. Where function f is defined as
f= x(1)*x(2)
x(1)= [1 2 3 4]
x(2)= [6 7 8]
Function f needs to be optimized using fmincon such as
fmin < f > fmax
My concern is how should I set or define constraint for given range of inputs {x(1) & x(2)}
I appreciate your time and help on this.
Thanks
0 commentaires
Réponses (2)
Matt Kindig
le 12 Juil 2012
Hi Mitesh,
I'm confused as to your problem formulation. The x(1)=[1 2 3 4] and x(2)=[6 7 8] are not valid MATLAB. What does this values indicate? Also, what are fmin and fmax?
When you save you have a given range of inputs {x(1) & x(2)}, what does that mean? Do you mean that x(1) and x(2) have upper and/or lower bounds?
Please clarify for us.
Thanks
Richard Brown
le 13 Juil 2012
I presume [1 2 3 4] and [6 7 8] are sets of possible values for x1 and x2. If your problem is only small, then you can use brute force
[X1, X2] = meshgrid([1 2 3 4], [6 7 8]);
F = X1 .* X2;
I = find(F > fmin & F < fmax);
[minval, j] = min(F(I));
minidx = I(j);
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!