%% Example of a Globally Conformal Mapping: w = Az, A ≠ 0 %% CSUMS Summer 2010 A.O. Hausknecht %% Written using OCTAVE function plotAz_SquareGrid(A=0.5) printf("A = %g\n", A) clf; %% Default grid parameters minXY = -4; maxXY = 4; n = 16; delta = (maxXY-minXY)/n; %% Create A Plot Of The Rectangular Grid subplot (1, 2, 1) title ("Grid of Squares") hold on %% Draw left-top filled square x1 = maxXY-1; x2 = maxXY; rectX = [x1 x2 x2 x1]; y1 = x1; y2 = x2; rectY = [y1 y1 y2 y2]; %% Fill with gray fill (rectX, rectY, [0.9 0.9 0.9]) %% Draw the vertical lines y = minXY:delta:maxXY; for x = minXY:delta:maxXY plot( x*ones(1, n+1) , y,'b') end %% Draw the horizontal lines x = minXY:delta:maxXY; for y = minXY:delta:maxXY plot(x, y*ones(1, n+1), 'r') end plot(0, 0, 'o', 'markersize', 4, 'color', 'k') %% %% Set the axes scaling, domain, and range axis('equal') rMax = max([maxXY*sqrt(2)*abs(A), maxXY*sqrt(2)]); axis([-rMax rMax -rMax rMax]) %% Draw Unit Tangents at z = x1+y1*i %% 1. Draw the Unit Tangent in the i-direction tx = [x1 x1]; ty = [y1 (y1+1)]; line(tx, ty, 'linewidth',3, 'color', 'blue') %% 1. Draw the Unit Tangent in the r-direction tx = [x1 (x1+1)]; ty = [y1 y1]; line(tx, ty, 'linewidth',3, 'color', 'red') hold off %% Create A Plot Of The Image Of The Rectangular Grid subplot (1, 2, 2) str = strcat("Image of Grid Under w = (", num2str (A, "%5.2f"), ")z"); title (str) hold on %% Draw the image of a square under w = Az %% Need to form a list of x-values and y-values %% along the image's boundary in counter-clockwise order. y = minXY:delta: maxXY; xy = maxXY-1; t = xy:.1:maxXY; %% Bottom edge's image w = A*(t + xy*i); u1 = real(w); v1 = imag(w); %% Right edge's image w = A*(maxXY + t*i); u2 = real(w); v2 = imag(w); %% %% Revere the order of the t-values so that the points on %% the top and left edges are generated in counter-clockwise order. t = fliplr (t); %% Top edge's image w = A*(t + maxXY*i); u3 = real(w); v3 = imag(w); %% Left edge's image w = A*(xy + t*i); u4 = real(w); v4 = imag(w); %% %% Now collect all the points in the correct order! u = cat(2, u1, u2, u3, u4); v = cat(2, v1, v2, v3, v4); %% Finally, fill the image of the square fill (u, v, [0.9 0.9 0.9]) %% Draw the images of the vertical lines y = minXY: maxXY; for x = minXY:delta:maxXY w = A*(x+y*i); plot(real(w), imag(w),'b') end %% Draw the images of the horizontal lines x = minXY:delta: maxXY; for y = minXY:delta:maxXY w = A*(x+y*i); plot(real(w), imag(w),'r') end plot(0, 0, 'o', 'markersize', 4, 'color', 'k') %% Set the axes scaling, domain, and range axis('equal') axis([-rMax rMax -rMax rMax]) %% Draw the images of the unit tangents under w = Az %% Note: dw = Adz, %% %% 1. Plot The image of the unit tangent in the i-direction z = xy+xy*i; dz = 0+1*i; w = A*z; dw = A*dz; tx = [real(w) real(w+dw)]; ty = [imag(w) imag(w+dw)]; line(tx, ty, 'linewidth',3, 'color', 'blue') %% %% 2. Plot The image of the unit tangent in the real-direction dz = 1 + 0*i; dw = A*dz; tx = [real(w) real(w+dw)]; ty = [imag(w) imag(w+dw)]; line(tx, ty, 'linewidth',3, 'color', 'red') hold off end