How do I plot this in MATLAB ?

조회 수: 2 (최근 30일)
simran
simran 2023년 8월 24일
댓글: Angelo Yeo 2023년 8월 25일
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!

채택된 답변

Angelo Yeo
Angelo Yeo 2023년 8월 24일
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
simran
simran 2023년 8월 24일
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 2023년 8월 25일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by