How to shift and re plot 4 rectangles ?
이전 댓글 표시
I have a rectangle xrect = [x1 x2 x3 x4 x1]; yrect = [y1 y2 y3 y4 y1];
I have plotted the rectangle, but I need to shift it by 10, to make for different rectangle in different positions, so that each new rectangle centroid will be the corner of the xrect,yrect original rectangle.
Some code I have:
shift = 10;
xyrect = [xrect; yrect];
shiftsRec = [xyrect(1)-[shift,0]; xyrect(2) + [shift,0]; xyrect(3) - [0,shift]; xyrect(4) + [0,shift]];
for i=1:4
temp = shiftsRec(i,:);
newRect(i) = [xyrect * temp];
plot(newRectangles);
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
