% 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(0,2*pi,20);
[uu,vv] = meshgrid(u,v);

% transformation
Gx = inline('u.*cos(v)');
Gy = inline('u.*sin(v)');
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);
