⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circ.m

📁 包含大量遗传算法程序
💻 M
字号:
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 ( > 1 ) is optional and specifies the
%       number of points on each circle.
%       The default is n = 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
% MRN0026
% MRN0039

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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -