How do I plot this in MATLAB ?
조회 수: 2 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!