%Example of drawing an ellipse and a square. Note that both shapes are %drawn via the function 'rectangle' clear; figure; hold on; %1. Draw a curve: just to show the shapes can be superposed to a %traditional plot. v = -1:0.1:1; plot(v,v.^3, 'linewidth',2); %2. This draws a rectangle with lower left corner at (-0.5 0.5) and of %width/height 0.2 r1 = rectangle('position',[-0.5 0.5 0.2 0.2],'linewidth',2); %3. This draws an ellipse with lower left corner of the bounding box at %(0.2,-0.5), width of 0.2 and height of 0.3. r2 = rectangle('position',[0.2 -0.5 0.2 0.3],'curvature',[1 1],'linewidth',2); set(r1,'facecolor','r'); %Paint the square surface red