The code below
figure; hold on;rectangle('Position',[1 2 5 6])axis([0 10 0 10])plot([1 6],[8 2],'k')plot([1 6],[2 8],'k')
Draws a rectangle and I manually plotted 2 lines to conect the vertices of the rectangle, to draw the two diagonals of the rectangle.
Is there an easier or faster way to draw the diagonals of a rectangle, after you created it with the rectangle function?
Best Answer