Code covered by the BSD License  

Highlights from
Bright circle with dark background

image thumbnail
from Bright circle with dark background by Nabin
I wanted to generate a circle with dark background. The function circle_bg.m does it.

circle_bg(r,xc,yc,N)
function circle_bg(r,xc,yc,N)
% The function can be used to get a circle of desired radius with dark
% background.
% Some work may be added to have the flexibility in terms of color of
% foreground and background.
% 
%   r = radius of the circle
%   (xc,yc) = center of the circle
%   N = number of points to be considered.
% 
% Usage:        circle_bg(4,0,0,1000)
% 
% Created By:   Nabin Malakar
% Date:         Nov. 23, 2009
%
% just as an example:
%   r = 4;
%   xc = 0; yc= 0;
%   N = 1000;
if (nargin ~= 4)
 error('Please see help: help circle_bg');
else
t=0:2*pi/N:2*pi;

x=r*cos(t)+xc;
y=r*sin(t)+yc;

figure1 = figure('Color',[0 0 0]);

axes1 = axes('Parent',figure1,'PlotBoxAspectRatio', [1 1 1],'Color',[0 0 0]);
% box('on');
patch(x,y,[1,1,1])
axis square
end

Contact us at files@mathworks.com