how to plot 5 figures at the same time when i run without overlapping each others ?

조회 수: 3 (최근 30일)
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.

답변 (1개)

Walter Roberson
Walter Roberson 2014년 4월 13일
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)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by