How to shift and re plot 4 rectangles ?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!