how to plot 5 figures at the same time when i run without overlapping each others ?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!