?? fblkb.m
字號:
%FBLKB Frequency-domain block-build (MIMO).
%
% A script file which assembles subsystem MVFR files named
% F1,F2,...,Fn into a single file named F, for use with function FCON.
% It also creates the matrix sz needed by FCON.
%
% Before calling FBLKB the following variables must exist:
% w = the frequency vector
% fblks = a vector of integers. If fblks(i)==x then the i'th
% subsystem's frequency response should be in 'FX', where
% X = int2str(x). If fblks is a single integer n, it is expanded
% to the vector 1:n.
% {FX} = set of MVFR matrices containing frequency responses of
% subsystems. Only those FX's identified in fblks are used, and
% they are assembled into F in the order in which they appear
% in fblks.
%
% If the variable verbose == 1 then fblkb reports what it finds.
%
% Existing variables sz and F are overwritten.
% Copyright (C) 1989 by Cambridge Control Ltd
% J.M.Maciejowski, 8 March 1989. Revised 5 May 1989.
f_trace = 0;
if exist('verbose')
if verbose == 1
f_trace = 1;
disp('FBLKB')
end
end
% Find frequency list w:
if ~exist('w'),
disp(' ERROR: Frequency list w does not exist')
clear f_trace;
return
end
% Find fblks and expand if necessary:
if exist('fblks')
if length(fblks)==1,
f_nblk = 1:fblks; % Expand
else
f_nblk = fblks(:)'; % Make sure it's a row vector
end
if isempty(f_nblk),
if f_trace,
disp(' No block numbers defined')
end
clear f_trace f_nblk;
return
elseif f_trace
disp(' Frequency response block numbers are (fblks) :')
disp(f_nblk)
end
else
disp(' ERROR: Variable fblks does not exist')
clear f_trace f_nblk;
return
end
% Define values of yes and no for user input:
yes = 1; no = 0;
f_yesno = no;
if exist('sz'),
if f_trace,
disp(' WARNING: Pre-existing variable sz will be overwritten')
f_yesno = input(' Shall I continue (yes/no) ? ');
if f_yesno ~= yes,
disp('*** ABORTING FBLKB to avoid overwriting sz')
clear f_trace f_nblk yes no f_yesno;
return
end
end
sz=[];
end
f_yesno = no;
if exist('F'),
if f_trace,
disp(' WARNING: Pre-existing variable F will be overwritten')
f_yesno = input(' Shall I continue (yes/no) ? ');
if f_yesno ~= yes,
disp('*** ABORTING FBLKB to avoid overwriting F')
clear f_trace f_nblk yes no f_yesno;
return
end
end
F=[];
end
% Assemble frequency responses:
for f_block = 1 : length(f_nblk),
f_num = f_nblk(f_block);
f_name = ['F',int2str(f_num)];
if ~exist(f_name),
if f_trace,
disp([' WARNING: Cannot find block ',f_name])
disp([' Block ',f_name,' omitted from F'])
end
else % Block exists
[f_out,f_in] = fsize(w,eval(f_name));
sz = [sz [f_in;f_out]];
if f_trace,
disp([' Block ',f_name,' has ',int2str(f_in),' inputs and ',...
int2str(f_out),' outputs'])
end
F = [ F, fget(w,eval(f_name)) ];
end
end
if f_trace,
[f_szr,f_szc] = size(sz);
disp(' ')
disp([' Number of blocks assembled in F : ',int2str(f_szc)])
end
% Clear all internal variables introduced by fblkb:
clear f_trace; % 1 if verbose==1, 0 otherwise
clear f_nblk; % Block naming integers
clear yes no; % == 1 , 0.
clear f_yesno; % User's response
clear f_block; % Ordinal number of block being handled
clear f_num; % Integer name of block being handled
clear f_name; % Name of block (as string)
clear f_in; % Number of inputs of block being handled
clear f_out; % Number of outputs of block being handled
clear f_szr; % Number of rows in sz
clear f_szc; % Final number of columns in sz
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -