function c=circ(cent,rad,n)
%CIRC	Calculates circles
%	CIRC(CENT,RAD,n) calculates a matrix of
%	complex numbers the ith column of which
%	represents a circle centre CENT(i) and radius RAD(i).
%	CENT and RAD can be vectors or scalars.
%	The input argument n is optional and specifies the
%	number of points on each circle.
%	The default is 51 points.
%
%	The circle runs from angle(cent) to angle(cent)+2*pi.
%	See also ARC,NCIRC,MCIRC

%	Dr M.P. Ford 4th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd

nargs=nargin;
error(nargchk(2,3,nargs));
if nargs < 3
   n=51;
end
if (max(size(n))~=1)|(n<=0)|(rem(n,1)~=0)
  error('N must be a positive integer')
end
lw=length(cent);
if lw~=length(rad)
   error('Number of Centres must equal the Number of Radii');
end
ang=[0:2*pi/(n-1):2*pi-2*pi/(n-1) 2*pi].';
c=zeros(length(ang),lw);
for i=1:lw
  c(:,i)=cent(i) + rad(i).*exp(sqrt(-1).*(ang+angle(cent(i))));
end

