How do I plot this in MATLAB ?
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Angelo Yeo
on 24 Aug 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 Comments
Angelo Yeo
on 25 Aug 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
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!