build-in optimization function for discrete date
이전 댓글 표시
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.
답변 (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, :)
카테고리
도움말 센터 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
