📄 isbalanced.m
字号:
function fval = isbalanced(sys)%ISBALANCED True if the given system is balanced.%% ISBALANCED(SYS) returns 1 if (A,B,C) is balanced and 0 otherwise. SYS% has to be an SS or IDSS object. The system is balanced iff the% observability gramian Wo and the controllability gramian Wc are equal.%% See also GRAM, SS, IDSS, MPBAL, BALREAL, ISMPBALANCED.%% CUED System Identification Toolbox.% Cambridge University Engineering Department.% Copyright (C) 1998-2002. All Rights Reserved.% Version 1.00, Date: 01/06/2002% Created by H. Chen and E.C. Kerrigan.if isa(sys,'idss') sys = ss(sys.a,sys.b,sys.c,sys.d,sys.Ts);elseif ~isa(sys,'ss') error('The given system is not an SS or IDSS object.')endWc = gram(sys,'c'); % Controllability GramianWo = gram(sys,'o'); % Observability Gramiantol = 1e3*eps; % A small toleranceif norm(Wc-Wo) > tol if nargout == 0 disp(sprintf('System is not balanced; norm(Wc-Wo) = %4.2e.',norm(Wc-Wo))) else fval = 0; endelse if nargout == 0 disp(sprintf('System is balanced; norm(Wc-Wo) = %4.2e.',norm(Wc-Wo))) else fval = 1; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -