function [f,grad] = simplefg(x) % function used in the Automatic Differenziation Chapter f = (x(2) - x(1).^2).^2 + (1 - x(1)).^2; grad = dlgradient(f,x); end