4 May 2017

draw rectangle, polygon and circle in Matlab

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().

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.

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.


  1. Great and really helpful article! Adding to the conversation, providing more information, or expressing a new point of view...Nice information and updates. Really i like it and everyday am visiting your site..
    Office Interiors in Chennai
    Interior Decorators in Chennai

  2. mcafee.com/activate Online Help – Call 1-844-584-0060 Tollfree. Step by Step guide for McAfee Activation, Download & complete installation online. www.mcafee.com/activate or Mcafee activate

  3. norton.com/setup sells Retail Cards which is available in many retail stores. Norton Retail Cards allow you to download your security product from the internet rather than installing from a CD. Downloading security product from the internet ensures you, your setup is the most recent version.