?? vgain.m
字號:
function Kv = vgain(system)
% Computes the velocity error constant Kv given the
% transfer function of a system.
%Inputs: system - lti object
%Output: Kv - velocity error constant
%
% See also DCGAIN
%%%%%%%%%%%%%%%%%%% vgain.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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[num,den,Ts] = tfdata(system,'v');
den = small20(den,eps);
num = small20(num,eps);
len_den = length(den);
len_num = length(num);
%
if Ts == 0 % continuous-time system
if den(len_den) ~= 0 % constant term in den not zero
% ie, no integrator
disp('System is type-0, Kv = 0')
Kv = 0;
else
disp('System type is greater than or equal to 1')
Kv = num(len_num)/den(len_den-1);
end
else % discrete-time system
if abs(sum(den)) > 1e-10 % no pole at z=1
disp('System is type-0, Kv = 0')
Kv = 0;
else
disp('System type is greater than or equal to 1')
system1 = tf([1 -1],[1 0],Ts);
system2 = system*system1;
Kv = dcgain(system2);
end
end
return
%%%%%%%%%%
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -