Transformation of the complex plan: Conformal Mapping
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to write a code in Matlab that explains a conformal mapping under the transformation w=z^2+1/z. How can I do that?(I've already read the link: Exploring a Conformal Mapping, but with this particular transformation I failed).
12 Kommentare
Antworten (3)
Anton Semechko
am 9 Jul. 2018
Bearbeitet: Anton Semechko
am 9 Jul. 2018
Modified code ('conformal_map_demo') is attached below. In principle, this piece of code should should allow you to visualize any complex analytic function. You just have to modify the 'f' function manually.
Example for f=z^2
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189826/image.jpeg)
Example for f=z^2+1/z
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189828/image.jpeg)
function conformal_map_demo
% Grid settings
XLim=5*[-1 1];
n = 20;
dX=(XLim(2)-XLim(1))/n;
% Initialize figure
figure
ha1=subplot(1, 2, 1);
title ('Grid of Squares')
axis('equal')
hold on
ha2=subplot(1, 2, 2);
title ('Image Of Grid Under w = z^2 + 1/z')
axis('equal')
hold on
% ============================== PRE-IMAGE ================================
axes(ha1)
% Draw reference square at top-right corner
% -------------------------------------------------------------------------
su=[0 0; 1 0; 1 1; 0 1]; % unit square
s=bsxfun(@plus,dX*su,XLim(2)*[1 1]-dX);
fill(s(:,1),s(:,2),[0.9 0.9 0.9])
% Draw vertical grid lines at dX intervals
% -------------------------------------------------------------------------
for x=XLim(1):dX:XLim(2)
plot(x*ones(1,2),XLim,'b')
end
% Draw horizontal grid lines at dX intervals
% -------------------------------------------------------------------------
for y=XLim(1):dX:XLim(2)
plot(XLim,y*ones(1,2), 'r')
end
% Draw Unit Tangents for the reference square
% -------------------------------------------------------------------------
x1 = XLim(2)-dX;
y1 = x1;
% 1. Draw the Unit Tangent in the i-direction
a = [x1 x1];
b = y1 + dX*[0 1];
line(a, b, 'linewidth',3, 'color', 'blue')
% 2. Draw the Unit Tangent in the r-direction
a = x1 + dX*[0 1];
b = [y1 y1];
line(a,b, 'linewidth',3, 'color', 'red')
hold off
% Set axes domain, and range
axis((XLim(2)+dX)*[-1 1 -1 1])
% ================================ IMAGE ==================================
axes(ha2)
f=@(z) z.^2 + 1./z;
% Draw the image of the reference square
% -------------------------------------------------------------------------
% Subdivide original reference square; to insert more points between corners
for i=1:8
s_new=(s+circshift(s,[-1 0]))/2;
s=reshape(cat(1,s',s_new'),2,[]);
s=s';
end
f_s=f(s(:,1)+1i*s(:,2));
fill(real(f_s),imag(f_s),[0.9 0.9 0.9])
% Draw images of the vertical lines
% -------------------------------------------------------------------------
BB=Inf*[1 -1;1 -1];
yy=linspace(XLim(1),XLim(2),1E3)';
for x = XLim(1):dX:XLim(2);
w=f(x*ones(1E3,1) + 1i*yy);
u=real(w);
v=imag(w);
plot(u,v,'-b')
if x~=0
BB(:,1)=min(BB(:,1),[min(u);min(v)]);
BB(:,2)=max(BB(:,2),[max(u);max(v)]);
end
end
% Draw the images of the horizontal lines
% -------------------------------------------------------------------------
xx=yy;
for y = XLim(1):dX:XLim(2);
w=f(xx+1i*y*ones(1E3,1));
u=real(w);
v=imag(w);
plot(u,v,'-r')
if y~=0
BB(:,1)=min(BB(:,1),[min(u);min(v)]);
BB(:,2)=max(BB(:,2),[max(u);max(v)]);
end
end
% Draw the images of the unit tangents under w
% -------------------------------------------------------------------------
% Jacobian the map
syms x y
Jxx=diff(real(f(x+1i*y)),'x');
Jxy=diff(real(f(x+1i*y)),'y');
Jyy=diff(imag(f(x+1i*y)),'y');
Jyx=diff(imag(f(x+1i*y)),'x');
J=[Jxx Jxy; Jyx Jyy];
% Evaluate Jacobian at the bottom-left corner of the reference square
c=XLim(2)*[1 1];
Jc=dX*double(subs(J,[x,y],c));
% Visualize new tangent vectors at c
[Ux,Uy]=deal([real(f_s(1)) imag(f_s(1))]);
Ux=[Ux;Ux+Jc(:,1)'];
Uy=[Uy;Uy+Jc(:,2)'];
plot(Ux(:,1),Ux(:,2),'-r','LineWidth',3)
plot(Uy(:,1),Uy(:,2),'-b','LineWidth',3)
% Set axes domain and range
BB(:,1)=min(BB(:,1),min([Ux;Uy])');
BB(:,2)=max(BB(:,2),max([Ux;Uy])');
dB=BB(:,2)-BB(:,1);
BB(:,1)=BB(:,1)-0.025*dB;
BB(:,2)=BB(:,2)+0.025*dB;
set(ha2,'XLim',BB(1,:),'YLim',BB(2,:))
0 Kommentare
abd abd1
am 13 Sep. 2019
here is my code in MATLAB to generate julia set in complex domain
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!