Borrar filtros
Borrar filtros

How do I plot this in MATLAB ?

1 visualización (últimos 30 días)
simran
simran el 24 de Ag. de 2023
Comentada: Angelo Yeo el 25 de Ag. de 2023
Above is the image of circular grid under f(z)=z/(1-z) in "complex tool" given by jim rolf.
I want to plot images of such circular grids (|z|<1) under any complex map f(z)=x(z)+i*y(z) in MATLAB. so if anyone could help me with the code so that i can plot these in MATLAB .
Thanks, i would really appreciate the help!

Respuesta aceptada

Angelo Yeo
Angelo Yeo el 24 de Ag. de 2023
n_rays = 16 + 1;
n_circles = 9 + 1;
n_samples = 200;
rays = linspace(0, 1, n_samples)' * exp(1j*linspace(0, 2*pi, n_rays));
interior_circles = linspace(0, 1, n_circles)' * (cos(linspace(0, 2*pi, n_samples)) + 1j * sin(linspace(0, 2*pi, n_samples)));
interior_circles = transpose(interior_circles);
%% plotting
figure;
subplot(1,2,1);
for i_rays = 1:n_rays
plot(real(rays(:,i_rays)), imag(rays(:,i_rays)),'Color',[88, 140, 102]/ 255)
hold on;
end
for i_circle = 1:n_circles
plot(real(interior_circles(:,i_circle)), imag(interior_circles(:,i_circle)),'Color','r')
end
axis square
xlim([-2, 2])
ylim([-2, 2])
grid on;
subplot(1,2,2);
f = @(z) z./(1-z); % complex function to apply
for i_rays = 1:n_rays
plot(real(f(rays(:,i_rays))), imag(f(rays(:,i_rays))),'Color',[88, 140, 102]/ 255)
hold on;
end
for i_circle = 1:n_circles
plot(real(f(interior_circles(:,i_circle))), imag(f(interior_circles(:,i_circle))),'Color','r')
end
axis square
xlim([-2, 2])
ylim([-2, 2])
grid on;
  2 comentarios
simran
simran el 24 de Ag. de 2023
Thankyou very much for the help! It is exactly what i wanted. Also, if you could recommend me some ways to make it look more attractive and colorful with some styles? like in the picture attached or maybe you could recommend some other sources where i can learn different styles of such coloring ?
Angelo Yeo
Angelo Yeo el 25 de Ag. de 2023
Please refer to the doc for "plot".
https://www.mathworks.com/help/matlab/ref/plot.html?s_tid=srchtitle_site_search_1_plot#btzitot_sep_mw_3a76f056-2882-44d7-8e73-c695c0c54ca8

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by