收藏到CSDN网摘
To draw these shapes in Matlab, different ways could be used to achieve this. Write your own function to use plot(), or use rectangle() or use patch().
Pros:
The rectangle() can be used to draw ellipse, circle, round-corner rectangle as well if you specify the 'Curvature' parameter.
The plot() and patch() uses the same input as (x,y) list, which means x, and y are vectors of corresponding coordinates. You can use these two function draw polygons with any number of points.
Cons:
rectangle() uses input as [x,y,w,h] rather than (x,y) list. rectangle() can only accept input as a 4 elements vector. It requires calling of daspect([1,1,1]) to make the equality along each axis. However, it is very handy if you are drawing proper rectangle and circle.