Optimizing a function from a given set?
Ältere Kommentare anzeigen
Is there a way to find the optimal value of a minimized function from a given set of solutions?
Here is an example of what I would like to do:
For x in {0,0.5,1}, solve: x = arg max f(x).
I think I would need a variation of "fminbnd", as this one uses a given interval of solutions, while I need a given set of solutions.
Any suggestion would be very much appreciated. Thank you
Akzeptierte Antwort
Weitere Antworten (1)
Mohamed Larabi
am 17 Jun. 2018
0 Stimmen
1 Kommentar
Walter Roberson
am 17 Jun. 2018
If f(y) is given, then the x that maximizes x*f(y) is:
if f(y) > 0
bestx = max(x);
elseif f(y) < 0
bestx = min(x);
else
all finite non-nan entries in x give the same result
end
Kategorien
Mehr zu Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!