%--- Function to compute the numerical gradient at a point ---
% Patrick Roberts SySc 512 (may 2007)
function [gradX gradY] = grad(f, pt, delta)  
    deltaX = f(pt(1) + delta, pt(2)) - f(pt(1), pt(2));
    deltaY = f(pt(1), pt(2) + delta) - f(pt(1), pt(2));
    gradX = deltaX/delta;
    gradY = deltaY/delta;
end
