📄 set.m
字号:
function model = set(model,varargin)%BILIN/SET Property setting method for BILIN object.%% 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.[n,m]=size(model.B);p=size(model.C,1);if nargin < 2 model = []; model.A = 'A-matrix (n-by-n matrix)'; model.B = 'B-matrix (n-by-m matrix)'; model.C = 'C-matrix (p-by-n matrix)'; model.D = 'D-matrix (p-by-m matrix)'; model.N = 'N-matrix (n-by-n*m matrix)'; model.X0 = 'X0-matrix (initial states) (n-by-1 matrix)'; model.Ts = 'Scalar (sample time in seconds)'; else property_argin = varargin; while length(property_argin) >= 2 prop = property_argin{1}; val = property_argin{2}; property_argin = property_argin(3:end); switch upper(prop) case 'A' if size(val,1) == n & size(val,2) == n model.A = val; else error('The dimension of A is incompatible with the BILIN object.') end case 'B' if size(val,1) == n & size(val,2) == m model.B = val; else error('The dimension of B is incompatible with the BILIN object.') end case 'C' if size(val,1) == p & size(val,2) == n model.C = val; else error('The dimension of C is incompatible with the BILIN object.') end case 'D' if size(val,1) == p & size(val,2) == m model.D = val; else error('The dimension of D is incompatible with the BILIN object.') end case 'N' if size(val,1) == n & size(val,2) == n*m model.N = val; else error('The dimension of N is incompatible with the BILIN object.') end case {'X0','X'} if size(val,1) == n & size(val,2) == 1 model.X0 = val; else error('The dimension of X0 is incompatible with the BILIN object.') end case {'TS','T'} if size(val,1) == 1 & size(val,2) == 1 if val > 0 model.Ts = val; else error('Only positive values of Ts are allowed.') end else error('The dimension of Ts is incompatible with the BILIN object.') end otherwise error(['''', prop, '''', ' is not a valid BILIN property.']) end end end% *** last line of set.m ***
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -