phlag.m

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

M
46
字号
function [ka,kb,kc,kd] = phlag(dbchange,endfreq,hfgain)
%PHLAG  design a phase lag compensator
%
%       [kn,kd] = phlag(dbchange,endfreq,hfgain)
%       [kn,kd] = phlag(dbchange,endfreq)
%       [ka,kb,kc,kd] = phlag(dbchange,endfreq,hfgain)
%       [ka,kb,kc,kd] = phlag(dbchange,endfreq)
%
%       PHLAG returns a first order lag compensator
%       with a change of DBCHANGE decibels between low and high frequencies.
%       If DBCHANGE is positive a phase lead compensator is returned.
%       ENDFREQ specifies the frequency (in rad/s) at which the gain change 
%       is essentially finished. (This is the upper corner frequency of the
%       compensator. Note that up to 45 degrees lag may remain at ENDFREQ.)
%       HFGAIN specifies the high-frequency gain of the compensator in 
%       decibels. If HFGAIN is omitted a value of 0 decibels is assumed.
%
%       [ka,kb,kc,kd]=PHLAG(DBCHANGE,ENDFREQ,HFGAIN) returns the compensator 
%       in state space form.
%       [kn,kd]=PHLAG(DBCHANGE,ENDFREQ,HFGAIN) returns the compensator in 
%       transfer function form.

%       J.M.Maciejowski, 8 Dec 1987.
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
%       MRN0019

nargs = nargin;
nout = nargout;
error(nargchk(2,3,nargs));
if nargs == 2
	hfgain = 0;     % default hf gain
end

% solve controller equations
ka = 10^(hfgain/20)*[1,endfreq];
if dbchange==(-inf), % This shouldn't be necessary
  kb = [1, 0];
else
  kb = [1, endfreq*10^(dbchange/20)];
end

% convert to state space if required
if nout == 4
	[ka,kb,kc,kd] = mvtf2ss(ka,kb);
end

⌨️ 快捷键说明

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