12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ectanglePurpose2rectangleCreate a 2-D rectangle objectSyntaxrectanglerectangle('Position',[x,y,w,h])rectangle(...,'Curvature',[x,y])h = rectangle(...)Description rectangle draws a rectangle with Position [0,0,1,1] and Curvature [0,0](i.e., no curvature).rectangle('Position',[x,y,w,h]) draws the rectangle from the point x,yand having a width of w and a height of h. Specify values in axes data units.Note that, to display a rectangle in the specified proportions, you need to setthe axes data aspect ratio so that one unit is of equal length along both the xand y axes. You can do this with the command axis equal ordaspect([1,1,1]).rectangle(...,'Curvature',[x,y]) specifies the curvature of the rectanglesides, enabling it to vary from a rectangle to an ellipse. The horizontalcurvature x is the fraction of width of the rectangle that is curved along the topand bottom edges. The vertical curvature y is the fraction of the height of therectangle that is curved along the left and right edges.The values of x and y can range from 0 (no curvature) to 1 (maximumcurvature). A value of [0,0] creates a rectangle with square sides. A value of[1,1] creates an ellipse. If you specify only one value for Curvature, then thesame length (in axes data units) is curved along both horizontal and verticalsides. The amount of curvature is determined by the shorter dimension.h = rectangle(...) returns the handle of the rectangle object created.Remarks Rectangle objects are 2-D and can be drawn in an axes only if the view is [0 90](i.e., view(2)). Rectangles are children of axes and are defined in coordinatesof the axes data.ExamplesThis example sets the data aspect ratio to [1,1,1] so that the rectangledisplays in the specified proportions (daspect). Note that the horizontal and2-386

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!