image Post Your Answer


image

Plotting of the rings


Hey, everyone, the sole problem which is troubling me nowadays is to plot two rings in 3D. I have no idea about it, but I need to learn it as soon as possible because my deadline is approaching and I have to use it in my thesis.
So, please help, and I would appreciate an early help.
Thanks in advance!!

All Answers (1 Answers In All)

By Mansi Singhal Answered 6 years ago

Try this code: N1 = 200; % Number Of Points In Ring R1 = 0.25 + 0.2*(rand(1, N1)-0.5); % Random Marker Radii A1 = linspace(0, 2*pi, N1); % Define Angle Vector Ring1 = R1.*[cos(A1); sin(A1)]; % Create Ring Coordinates N2 = 200; R2 = 0.85 + 0.2*(rand(1, N1)-0.5); A2 = linspace(0, 2*pi, N1); Ring2 = R2.*[cos(A1); sin(A1)]; figure plot(Ring1(1,:), Ring1(2,:), ‘^b’, ‘MarkerFaceColor’,’b’) hold on plot(Ring2(1,:), Ring2(2,:), ‘or’, ‘MarkerFaceColor’,’r’) hold off axis equal N1 = 200; % Number Of Points In Ring R1 = 0.25 + 0.2*(rand(1, N1)-0.5); % Random Marker Radii Z1 = 0.10 + 0.2*(rand(1, N1)-0.5); % Random Z-Values A1 = linspace(0, 2*pi, N1); % Define Angle Vector Ring1 = R1.*[cos(A1); sin(A1)]; % Create Ring Coordinates N2 = 200; R2 = 0.85 + 0.2*(rand(1, N1)-0.5); Z2 = 0.80 + 0.2*(rand(1, N1)-0.5); A2 = linspace(0, 2*pi, N1); Ring2 = R2.*[cos(A1); sin(A1)]; figure plot3(Ring1(1,:), Ring1(2,:), Z1, ‘^b’, ‘MarkerFaceColor’,’b’) hold on plot3(Ring2(1,:), Ring2(2,:), Z2, ‘or’, ‘MarkerFaceColor’,’r’) hold off axis equal grid on


Your Answer


View Related Questions