Matlab code of mobius transform

27 次查看(过去 30 天)
I need to write a code to convert a series of lines into a series of circles, and here are the pictures I have. I know I should use Möbius transformation, and I have searched a lot but I don't understand what I should do. Could anyone help?

采纳的回答

William Rose
William Rose 2024-1-2
编辑:William Rose 2024-1-2
[edit: added SAAAA to the reply]
consider the points on a circle to be points on the complex plane, z=x+iy. A straight line is a circle with an infinite radius. The Möbius transformation maps circles (including straight lines) into circles. As you know, the Möbius transformation is
where z1 represents the points on the first circle and z2 are the points on the transformed circle. Experiment with different values for a,b,c,d and you will learn what values can do what.
Example:
Define and plot three straight lines
z1a=-ones(1,101)+i*[-10:.2:10]; % vertical line
z1b=-2*ones(1,101)+i*[-10:.2:10]; % vertical line
z1c=[-10:.2:10]+i*ones(1,101); % horizontal line
plot(z1a,'-r.'); hold on; plot(z1b,'-g.'); plot(z1c,'-b.'); axis equal
Transform the points with a Möbius transformation with b=c=1 and a=d=0:
z2a=1./z1a; z2b=1./z1b; z2c=1./z1c;
Plot transformed points:
figure;
plot(z2a,'-r.'); hold on; plot(z2b,'-g.'); plot(z2c,'-b.');
axis equal
OK
  4 个评论
SAAAA
SAAAA 2024-1-6
Thanks alot for your helpful reply
William Rose
William Rose 2024-1-8
@SAAAA, you arew welcome. Good luck with your studies.

请先登录,再进行评论。

更多回答(1 个)

Ayush
Ayush 2024-1-3
I understand that you need to write a code to convert a series of lines into a series of circles. Here is the code you can start with:
% Define the grid of points
[x, y] = meshgrid(linspace(-2, 2, 1000), linspace(-2, 2, 1000));
z = x + 1i * y; % Convert the grid to complex numbers
% Define the Möbius transformation with a fixed point at the origin
a = 0;
b = 1;
c = 1;
d = 0;
f = @(z) (a * z + b) ./ (c * z + d);
% Define the range for the lines
line_range = linspace(-2, 2, 20);
% Plot the original grid
figure;
subplot(1, 2, 1);
hold on;
for k = line_range
plot(x(1, :), k * ones(size(x(1, :))), 'b'); % Horizontal lines
plot(k * ones(size(y(:, 1))), y(:, 1), 'r'); % Vertical lines
end
axis equal;
xlim([-2, 2]);
ylim([-2, 2]);
title('Original Grid');
% Plot the transformed grid
subplot(1, 2, 2);
hold on;
for k = line_range
% Apply the Möbius transformation to each horizontal line
horizontal_line = f(x(1, :) + 1i * k);
plot(real(horizontal_line), imag(horizontal_line), 'b'); % Transformed horizontal lines
% Apply the Möbius transformation to each vertical line
vertical_line = f(k + 1i * y(:, 1));
plot(real(vertical_line), imag(vertical_line), 'r'); % Transformed vertical lines
end
axis equal;
xlim([-1.5, 1.5]); % Adjust axis limits if necessary
ylim([-1.5, 1.5]); % Adjust axis limits if necessary
title('Transformed Grid');
% Make sure the plots hold their properties
hold off;
Thanks,
Ayush

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by