bodedb.m

来自「ipr函数库与仿真实验程序,都是要用到的库函数。」· M 代码 · 共 32 行

M
32
字号
function [mag_db,phase,w1] = bodedb(G,w)
%   function to compute the magnitude (in dB) and phase of the 
%   frequency response of a single-input, single-output 
%   lti system object G. The outputs mag and phase 
%   are regular arrays. This function requires the 
%   function bode.
%
% inputs - G - LTI system object
%          w - frequency array
% output - mag - magnitude in dB
%          phase - phase in degrees
%          w1  - frequency array

%%%%%%%%%%%%%%%%%%%% bodedb.m %%%%%%%%%%%%%%%%%%%
%   Discrete-Time Control Problems using        %
%       MATLAB and the Control System Toolbox   %
%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %
%         Brooks/Cole Publishing Company        %
%                September 2002                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if nargin == 1
   [mag_ratio,phase,w1] = bode(G);
  else
   [mag_ratio,phase,w1] = bode(G,w);
end
%---- convert magnitude to dB & remove singleton dimension
mag_db = squeeze(20*log10(mag_ratio)); 
phase = squeeze(phase);	      % remove singleton phase dimension
%%%%%%%%%%

⌨️ 快捷键说明

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