% demo for change of variables, MATH 2210-3
% author: Fernando Guevara Vasquez

% grid in the u,v plane
u = linspace(0,3,10);
v = linspace(1,3,10);
[uu,vv] = meshgrid(u,v);

% transformation
Gx = inline('u./(u.^2+v.^2)');
Gy = inline('-v./(u.^2+v.^2)');

figure(1); clf
title('uv (preimage) plane');
surf(uu,vv,ones(size(vv)));
xlabel('u'); ylabel('v');
axis equal; view(2);

figure(2); clf
title('xy (image) plane');
surf(Gx(uu,vv),Gy(uu,vv),ones(size(uu)));
xlabel('x'); ylabel('y');
axis equal; view(2);
