
 
N=201;
a=-1;b=1;
c=-1;d=1;
x=linspace(a,b,N);
y=linspace(c,d,N);

for i=1:N;
for j=1:N;
z(i,j)=2*x(j)*y(i)/(x(j)*x(j)+y(i)*y(i));

end;
end;
surf(x,y,z);
box on;
axis([-1 1 -1 1 -1 1]);
xlabel('x'); ylabel('y');zlabel('z');
title('$z=\displaystyle\frac{2xy}{x^2+y^2}$','Interpreter','latex');
view([-5 2 5]);
 
figure;
cc=[-0.1; -0.2;-0.3; -0.4; -0.5; -0.6; -0.7; -0.8;-0.85; -0.9; -0.95;-0.975;-0.99;-0.9995;
    0; 0.1; 0.2;0.3; 0.4; 0.5; 0.6; 0.7; 0.8;0.85; 0.9; 0.95;0.975;0.99;0.9995];
contour(x,y,z,cc)
axis([-1 1 -1 1]);
axis square;
title('Level curves: $z=\displaystyle\frac{2xy}{x^2+y^2}$','Interpreter','latex');
clear all;