function [f,dfdx,dfdy] = point(x,y) f = (x - 1).^2 + (y-1).^2; dfdx = 2.*(x-1); dfdy = 2.*(y-1);