I've blogged before about fitting circles, and about simply drawing circles. And I've blogged about fitting ellipses. I like the general utility of functionality that facilitates those common tasks. Today, I complete the suite with a Pick that trivializes the drawing of an ellipse.
David's syntax is quite nice:
There are defaults for all of the inputs (you'd get a circle of radius 1, plotted at [0,0]), but most usefully, you would specify, at a minimum, the semi-major (ra) and semi-minor (rb) axes lengths, the desired angle, and the coordinates of the center (plus, optionally, the color and the number of points used in the construction).
Remember Spirograph? Here's a fun little graphic I created using David's ellipse function, and another previous pick, distinguishable_colors:
colors = distinguishable_colors(20); n = 20; angles = linspace(0,2*pi,n); h = zeros(n,1); for ii = 1:n h(ii) = ellipse(2,1,angles(ii),0,0,colors(ii,:)); end axis equal axis off set(h,'linewidth',2) set(gcf,'color','w')
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.