ncirc.m
来自「包含大量遗传算法程序」· M 代码 · 共 32 行
M
32 行
function c=ncirc(n)
%NCIRC Calculates N-circles.
% NCIRC(N) returns a complex matrix with
% one circle per column.
% N is the vector of N-circle values in degrees.
% 0 degrees and multiples of 180 degrees and
% positive degree N-circles are not supported.
% See also MCIRC,CIRC,ARC
% Dr M.P. Ford 4th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
% MRN0026
if min(size(n))~=1
error('N must be a vector');
end
if any(n>=0)
error('N-circles with zero or positive degrees not supported');
end
if any(rem(n,180)==0)
error('N-circles that are multiples of 180 degrees not supported');
end
n=n.*(pi/180);
cent=-0.5+(sqrt(-1)./(2*tan(n)));
ang=[1599 (+1500:-100:+500) (+400:-40:+80) (+40:-10:-30)...
(-40:-40:-360) (-400:-100:-1500) -1599].';
ang=ang.*(pi/1600);
for i=1:length(n)
c(:,i)=cent(i) + cent(i).*exp(sqrt(-1).*ang);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?