Plot multiple rectangles from set of points

5 vues (au cours des 30 derniers jours)
Salem
Salem le 31 Août 2021
Modifié(e) : DGM le 31 Août 2021
If I have set of points 1, 2 , 3, 4, 5 they are name by NUM. These points respresnts locations on x-axis. How can I plot rectangles for each point making each point the center of the rectangles?

Réponse acceptée

DGM
DGM le 31 Août 2021
Modifié(e) : DGM le 31 Août 2021
Is this what you mean?
C = [1 1; 2 4; 3 2]; % center locations [x y]
for c = 1:size(C,1)
r = 0.5+rand(1,2)*0.5;
plot(C(c,1)+[-1 1 1 -1 -1]*r(1),C(c,2)+[-1 -1 1 1 -1]*r(2)); hold on
end

Plus de réponses (1)

Walter Roberson
Walter Roberson le 31 Août 2021
bar()

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by