mknic.m

来自「包含大量遗传算法程序」· M 代码 · 共 49 行

M
49
字号
function mknic(mag,ph,w,plt)
%MKNIC  Mark points along a Nichols plot.
%       MKNIC(MAG,PH,W,plt) marks the points MAG,PH
%       with the numbers in the vector W.
%       MAG,PH can be vectors or matrices.
%       If matrices columns are plotted against columns.
%       The input argument plt is optional and indicates
%       the number of plots per page either 1 or 4.
%       The default is 4.
%
%       MKNIC(C,W,plt) converts complex C to MAG and PH
%       and applies UNWRAP to PH before marking the plot.
%       Note C must have at least 1 non-zero imaginary part.
%
%       After converting the MAG to dB's
%       the plot is marked using MKPLOT.
%       MKPLOT turns HOLD OFF.
%       It also toggles the AXIS command.
%       See MKPLOT for more details.
%       See also PLOTNIC,R2P,UNWRAP,SUBPLOT.

%       Dr M.P. Ford 4th August 1987
% Copyright (c) 1987,1993 by GEC Engineering Research Centre and 
% Cambridge Control Ltd. All Rights Reserved.
% History: MRN0019
%   `fixphase' replaced by `unwrap', 29.5.93, JMM.

nargs=nargin;
error(nargchk(2,4,nargs));
if nargs==2
   w=ph;
   [mag,ph]=r2p(mag); % ph is in degrees
   ph=(180/pi)*unwrap(ph*pi/180); % fixphase replaced by unwrap,29.5.93,JMM.
   plt=4;
elseif nargs==3
   if (any(any(imag(mag))))
     plt=w;
     w=ph;
     [mag,ph]=r2p(mag); % ph is in degrees
     ph=(180/pi)*unwrap(ph*pi/180); %fixphase replaced by unwrap,29.5.93,JMM. 
   else
     plt=4;
   end
% else nargs==4   use the inputs as is
end
mag=20 .*log10(mag);
mkplot(ph,mag,w,plt);

⌨️ 快捷键说明

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