function OlympicRings(r, n, ring_colors) % Draws n olympic-style rings of radius r, with colors % specified by the rows of the n-by-3 matrix ring_colors % find the centers x = [0:n-1]*r*1.15; y = zeros(1,n); y([2:2:n]) = -r; % Preserve the status of "hold" in the long term, but hold for now t_hold = ishold; hold on; % Fill in the upper crossings left to right . . . % left and right quadrants of odd numbered (upper) rings % top and bottom quadrants of even numbered (lower) rings for k=1:n Arch(x(k),y(k),(1/4+k/2)*pi, (3/4+k/2)*pi, .85*r, r, ring_colors(k,1:3)); Arch(x(k),y(k),(5/4+k/2)*pi, (7/4+k/2)*pi, .85*r, r, ring_colors(k,1:3)); end % And the lower crossings right to left! % top and bottom quadrants of odd numbered (upper) rings % left and right quadrants of even numbered (lower) rings for k=n:-1:1 Arch(x(k),y(k),(3/4+k/2)*pi, (5/4+k/2)*pi, .85*r, r, ring_colors(k,1:3)); Arch(x(k),y(k),(7/4+k/2)*pi, (9/4+k/2)*pi, .85*r, r, ring_colors(k,1:3)); end if t_hold == 0 hold off end