improved objective function generation

This commit is contained in:
2026-01-14 18:24:14 -08:00
parent 4cce98a717
commit 105d91a492
3 changed files with 15 additions and 14 deletions

View File

@@ -1,13 +1,15 @@
function f = objectiveFunctionWrapper(center)
function f = objectiveFunctionWrapper(center, sigma)
% Convenience function to generate MVNPDFs at a point
% Makes it look a lot neater to instantiate and sum these to make
% composite objectives in particular
arguments (Input)
center (1, 2) double;
center (:, 2) double;
sigma (2, 2) double = eye(2);
end
arguments (Output)
f (1, 1) {mustBeA(f, 'function_handle')};
end
f = @(x,y) sum(cell2mat(arrayfun(@(i) mvnpdf([x(:), y(:)], center(i,:), sigma), 1:size(center,1), 'UniformOutput', false)), 2);
f = @(x, y) mvnpdf([x(:), y(:)], center);
end