📄 plotdb.m
字号:
function plotdb(w,mag,linetype)
%PLOTDB Plot Magnitude Bode diagrams.
% PLOTDB(W,MAG,'linetype') plots 20*log10(mag) in
% Bode format, with grids and labels.
% W is the frequency vector.
% MAG be either a vector or matrix.
% The input argument linetype is optional. If it is present
% it is used to set the plot line or point type.
% See PLOT for valid line types.
%
% PLOTDB(W,C,'linetype') plots the magnitude Bode plots of the
% complex matrix or vector C. In this form UNWRAP is applied
% to the phase before plotting.
%
% See also PLOTBODE,PLOTNYQ,PLOTNIC,UNWRAP.
% Dr M.P. Ford 4th August 1987,Revised J.M.Maciejowski, 13 Jan 1988
% Copyright (c) 1987,1993 by GEC Engineering Research Centre and
% Cambridge Control Ltd. All Rights Reserved.
% History: MRN0015
% `fixphase' replacedd by `unwrap', 29.5.93, JMM.
nargs=nargin;
error(nargchk(2,3,nargs));
[m,n]=size(mag);
if (length(w)~=m)&(length(w)~=n)
error('Frequency vector does not match points, did you forget FGET?')
end
if nargs ==3
if ~isstr(linetype)
error('Third input argument must be ''linetype''')
end
end
if nargs == 2
linetype=' ';
end
mag=r2p(mag);
if linetype==' ' % do not have linetype
semilogx(w,20*log10(mag)),grid,xlabel('FREQUENCY'),ylabel('MAG dB')
else
semilogx(w,20*log10(mag),linetype),grid,xlabel('FREQUENCY'),ylabel('MAG dB')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -