Why do that, when the gradient is analytically known?
function [y, dy] = fun_and_deriv(x,theta)
delta=theta-x;
y = norm(delta, "fro");
dy = delta./y;
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!