How to plot multiple figure using a for loop?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have written a program which helps me stack one figure over the other at different values along z axis. I want to include a loop, so that more values l1 to ln(presently l1 and l2) can be plotted in my program. My program is
% Plot 3D graph
l1 = [3;7;8;3]; % Laser measurement at different angle.
l2 = [3;6;7;3]; % Laser measurement at different angle.
C = 20; % Laser measurement to center.
x0 = 0; % Center of the object in the x direction.
y0 = 0; % Center of the object in the y direction.
t = [pi/6;pi/3;pi/2;pi/6];
z1 = 1;
z2 = 2;
r1 = C-(l1);
x1 = x0 + r1.*cos(t);
y1 = y0 + r1.*sin(t);
r2 = C-(l2);
x2 = x0 + r2.*cos(t);
y2 = y0 + r2.*sin(t);
scatter3(x1,y1,x2,y2,'X')
line(x1,y1)
line(x2,y2)
% Now display our set of points in a figure.
plot3(x1,y1,repmat(z1,size(x1)))
hold on
plot3(x2,y2,repmat(z2,size(x2)))
0 commentaires
Réponses (1)
KSSV
le 22 Juin 2017
You may follow something like this:
% Plot 3D graph
for i = 1:5
figure(i)
plot(rand(2,1),rand(2,1))
hold on
plot(rand(2,1),rand(2,1))
end
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!