clf; [x,y] = meshgrid(-1:0.1:3);
f=x.*exp(y);
x1=2; y1=0;
%[px,py] = gradient(f,x1,y1);
grad = [exp(y1), x1*exp(y1)];
[c,h] = contour(x,y,f,1:1:10);  clabel(c,h); hold on; 
%quiver(x1,y1,grad); 
m = grad(2)/grad(1);
xline = -1:0.01:3;
plot(xline,m.*(xline-x1) + y1);
plot(xline,-(1/m)*(xline-x1) + y1);
hold off; 
grid on;
