isbalanced.m

来自「剑桥大学用于线性和双线性动力学系统辨识的工具箱」· M 代码 · 共 42 行

M
42
字号
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 + =
减小字号Ctrl + -
显示快捷键?