how to plot 5 figures at the same time when i run without overlapping each others ?
3 views (last 30 days)
Show older comments
if i have this code
%// Set parameters
R = sqrt(10) ; %// radius
C = [0 0]; %// center [x y]
N = 50; %// number of points inside circle
%// generate circle boundary
t = linspace(0, 2*pi,100);
x = R*cos(t) + C(1);
y = R*sin(t) + C(2);
%// generate random points inside it
th = 2*pi*rand(N,1);
r = R*rand(N,1);
xR = r.*cos(th) + C(1);
yR = r.*sin(th) + C(2);
%// Plot everything
figure(1), clf, hold on
plot(x,y,'b')
text(0,0,'C')
plot(xR,yR,'p')
axis equal
radius=cell(4,1);
radius {1,1}=1;
radius {1,2}=0.5;
radius {1,3}=3;
radius {1,4}=2;
for j=1:4
for i=1:50
theta=0:.01:2*pi;
x=radius {1,j}*cos(theta)+rank1{i,2}(1);
y=radius {1,j}*sin(theta)+rank1{i,2}(2);
plot(x,y)
hold on
end
end
how to plot 5 figures at the same time when i run without overlapping each others ?when i run the code it gives me 1 figure with all the circles overlapping . i want one figure with the original circle and random points ,and the other 4 with the same circle and the same random points and inside it the other circles using the given radius.
0 Comments
Answers (1)
Walter Roberson
on 13 Apr 2014
Change the line
plot(x,y,'b')
to
subplot(1,5,1);
plot(x,y,'b');
hold on
After the line
for j=1:4
add the line
subplot(1,5,j+1)
0 Comments
See Also
Categories
Find more on Surface and Mesh 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!