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

📄 plotnic.m

📁 控制系统计算机辅助设计——MATLAB语言与应用(源代码)
💻 M
字号:
function plotnic(mag,ph,linetype)
%PLOTNIC        Plot Nichols chart.
%       PLOTNIC(MAG,PH,'linetype') plots MAG and PH in
%       Nichols format, with grids and labels.
%       That is it plots 20*log10(MAG) versus PH.
%       MAG and PH can be either vectors or matrices.
%       If matrices columns are plotted against columns.
%       The input argument linetype is optional.
%       If it is present it is used for the plot line or point type.
%       See PLOT for valid linetypes.
%
%       PLOTNIC(C,'linetype') plots Nichols plots of the
%       complex matrix or vector C.
%       In this form UNWRAP is applied to the phase before plotting.
%
%       Also see MKNICH,PLOT,PLOTBODE,PLOTNYQ,MCIRC,NCIRC

%       Dr M.P. Ford 4th August 1987
% Copyright (c) 1987,1993 by GEC Engineering Research Centre and 
% Cambridge Control Ltd. All Rights Reserved.
% History:
%  `Help' info corrected slightly: units of PH are not known 
%       to plotnic.  10..93, JMM.
%  `fixphase' replaced by `unwrap',29.5.93,JMM.

nargs=nargin;
error(nargchk(1,3,nargs));

if nargs==1
    linetype=' ';
    [mag,ph]=r2p(mag); % ph is in degrees
    ph=(180/pi)*unwrap(ph*pi/180);%`fixphase'replaced by `unwrap',29.5.93,JMM.
end % if nargs==1

if nargs==2
   if isstr(ph)
     linetype=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
     linetype=' ';
   end
end  % if nargs==2

if linetype==' '
   plot(ph,20.*log10(mag)),grid,xlabel('PHASE'),ylabel('dB')
else              % have linetype
   plot(ph,20.*log10(mag),linetype),grid,xlabel('PHASE'),ylabel('dB')
end

⌨️ 快捷键说明

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