build-in optimization function for discrete date
Mostrar comentarios más antiguos
I have a bivariate function with 100 known coordinate points. I want to find which one of these 100 points minimizes the function value. Is there any built-in MATLAB function for this? The optimization problem is straightforward, and I don't need a complex optimization algorithm, just one with sufficiently low time complexity.
2 comentarios
子青
el 27 de En. de 2024
Movida: Star Strider
el 5 de Feb. de 2024
子青
el 27 de En. de 2024
Movida: Star Strider
el 5 de Feb. de 2024
Respuestas (1)
So you have the function values at 100 different points and you want to know for which of those points the function takes on its minimum value? Just call min on the array of function values with two outputs.
coords = rand(10, 2);
z = peaks(coords(:, 1), coords(:, 2));
% Just store the coordinates and value in a table for easy viewing
results = table(coords(:, 1), coords(:, 2), z, 'VariableNames', ["x coord", "y coord", "z"])
[minimumValue, minimumLocation] = min(z)
To identify the coordinates where the minimum value in z is located:
coordinatesWhereMinimumOccurs = coords(minimumLocation, :)
Categorías
Más información sobre Nonlinear Optimization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
