Contents
FLBT for second-order systems
This demo script contains the application of the frequency-limited balanced truncation method (ml_ct_soss_flbt) on a test second-order system with only stable eigenvalues
M*x''(t) = -K*x(t) - E*x'(t) + Bu*u(t), y(t) = Cp*x(t) + Cv*x'(t) + D*u(t).
After loading the demo data, the optional parameters are assigned here explicitly and the ml_ct_soss_flbt function is called with its different input interfaces.
To show the performance of the model reduction method, the sigma error of the full-order and reduced-order model is plotted. In case the System Control Toolbox is installed, also a bode magnitude plot of the error system is shown.
% % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Affero General Public License as published % by the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU Affero General Public License for more details. % % You should have received a copy of the GNU Affero General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. % % Copyright (C) 2006-2018 Peter Benner, Steffen W. R. Werner %
Initialization
For demonstration, a random stable second-order system example was generated by the script morlab_data_so_stab.m and saved in morlab_data_so_stab.mat. The complete size of the system is saved in the datainfo structure.
if exist('OCTAVE_VERSION', 'builtin') orig_warn = warning('off', 'Octave:data-file-in-path'); load morlab_data_so_stab.mat; warning(orig_warn); else load morlab_data_so_stab.mat; end % Get information about installed/loaded toolboxes. hasControlPkg = size(license('inuse', 'control'), 2); hasControlTbx = license('test', 'control_toolbox');
Construction of the second-order system structure
To test the different input-output formats, the struct shapes of the second-order system is formulated here.
sys_struct = struct( ... 'M' , M, ... 'E' , E, ... 'K' , K, ... 'Bu', Bu, ... 'Cp', Cp, ... 'Cv', Cv, ... 'D' , D);
Set of optional parameters
The default values are mainly taken here, which can be modified. Alternative values depending on the system are commented out. Usually for using default values the corresponding parameters are not set or empty. Also, the function call "opts = ml_morlabopts('ml_ct_soss_flbt')" generates an empty option struct of the following form.
% Option struct for dual Lyapunov equation solver. lyapdlopts = struct(... 'AbsTol' , 0, ... 'CompTol', 1.0e-02 * sqrt(datainfo.n * eps), ... 'Info' , 0, ... % Info = 1 'MaxIter', 100, ... 'RelTol' , 1.0e+01 * 2*datainfo.n * eps); % Option struct for the complete function. opts = struct( ... 'BalanceType' , 'so', ... % BalanceType = 'p', 'pv', 'vp', ... 'FreqRange' , [1.0e+02, 1.0e+03], ... % FreqRange = [0 1.0e+03] 'lyapdlopts' , lyapdlopts, ... 'Method' , 'sr', ... % Method = 'bfsr' 'ModGramian' , 0, ... % ModGramian = 1 'Order' , 10, ... 'OrderComputation', 'sum', ... % OrderComputation = 'order', 'tolerance' 'Tolerance' , 1.0e-02);
Application of the function
Here the application of the ml_ct_soss_flbt function is shown for different interfaces and input-data. The default calls are commented out.
% Application with single matrices. % [Mr, Er, Kr, Bur, Cpr, Cvr, Dr, info] = ... % ml_ct_soss_flbt(M, E, K, Bu, Cp, Cv, D]; [Mr, Er, Kr, Bur, Cpr, Cvr, Dr, info] = ... ml_ct_soss_flbt(M, E, K, Bu, Cp, Cv, D, opts); % Application with structure. % [rom_struct, info_struct] = ml_ct_soss_flbt(sys_struct); [rom_struct, info_struct] = ml_ct_soss_flbt(sys_struct, opts);
Report
As visualization, a sigmaplot of the error system is made for the standard system structures and a bode magnitude plot for the state- space objects.
% Sigmaplot. figure; ml_sigmaplot(sys_struct, rom_struct, -4, 4, 100, [], 'b.'); legend('Sigma error'); title({'FLBT (sigmaplot, error system)'; ... ['Full order = ' int2str(size(M, 1)) '; ' ... 'Reduced-order = ' int2str(size(Mr, 1))]}); if hasControlTbx % Bode magnitude plot. bodeopts = bodeoptions('cstprefs'); bodeopts.MagUnits = 'abs'; sys_dss = dss( ... [zeros(size(M)), eye(size(M)); -K, -E], ... [zeros(size(Bu)); Bu], ... [Cp, Cv], ... D, ... blkdiag(eye(size(M)), M)); rom_dss = dss( ... [zeros(size(Mr)), eye(size(Mr)); -Kr, -Er], ... [zeros(size(Bur)); Bur], ... [Cpr, Cvr], ... Dr, ... blkdiag(eye(size(Mr)), Mr)); figure; bodemag(sys_dss - rom_dss, bodeopts); title({'FLBT (Bode magnitude plot)'; ... ['Full order = ' int2str(size(M, 1)) '; ' ... 'Reduced-order = ' int2str(size(Mr, 1))]}); end


See Also