Matlab code of mobius transform
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SAAAA
el 2 de En. de 2024
Comentada: William Rose
el 8 de En. de 2024
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?
1 comentario
Respuesta aceptada
William Rose
el 2 de En. de 2024
Editada: William Rose
el 2 de En. de 2024
[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 comentarios
Más respuestas (1)
Ayush
el 3 de En. de 2024
Hi @SAAAA
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
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!