Plot multiple rectangles from set of points

조회 수: 5 (최근 30일)
Salem
Salem 2021년 8월 31일
편집: DGM 2021년 8월 31일
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?

채택된 답변

DGM
DGM 2021년 8월 31일
편집: DGM 2021년 8월 31일
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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 8월 31일
bar()

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by