N = mor.norm(H)
N = mor.norm(H,ntype)
N = mor.norm(H,ntype,freqBand)
N = mor.norm(H,ntype,freqBand,opt)
This routine enables to compute different norms for dynamical systems.
H
is a state-space model, ntype
can be:
2
or 'H2'
: compute the (frequency-limited) H2 norm of the system.
'L2'
: compute the (frequency-limited) L2 norm of the system. Unlike the H2-norm, this one is finite even for unstable systems.
H
is a couple of frequencies and associated transfer matrices {w, H}
, ntype
can be:
inf
: maximum of the maximum absolute value of the transfer function at each sample point.
2
: averaged sum of squared Frobenius norm at each sample point.
'L2'
: trapezoidal approximation of the L2-norm.
'Linf'
: maximum of the 2-norm of the samples.
sys | Dynamical system or input-output data. More specifically sys can either be
|
ntype | Type of the norm to be computed (string, see in the above description part). |
freqBand | Frequency band on which the norm must be considered (2x1 vector with non-negative values). |
opt | Structure of options. |
N | Norm value (positive real scalar). |
Example 1: H2 and frequency-limited H2 norms. This example shows how to use the MOR Toolbox to compute the H2 and frequency-limited H2 norms of a state-space model. The latter is actually computed for several frequency intervals to illustrate that it tends towards the H2-norm.
H = ss(zpk([],[-0.1+3*1i,-0.1-3*1i,-0.05+10*1i,-0.05-10*1i,-0.01+20*1i,-0.01-20*1i],1));
h2norm = norm(H); % Matlab routine
h2norm2 = mor.norm(H); % MOR routine
% Computing the frequency-limited h2-norm for various intervals
W = logspace(0,1.4,100);
h2wnorm = zeros(20,1);
for i = 1:length(W)
interval = [0, W(i)];
h2wnorm(i) = mor.norm(H, 2, interval);
end
% Illustration of the frequency-limited h2-norm
G = bode(H,W);
figure
subplot(211)
semilogx(W, abs(squeeze(G)),'b')
set(gca(),'Xlim',[W(1),W(end)])
subplot(212)
semilogx([W(1),W(end)],h2norm * [1, 1], 'b')
hold on
semilogx([W(1),W(end)],h2norm2 * [1, 1], 'r--')
semilogx(W, h2wnorm, 'm')
set(gca(),'Xlim',[W(1),W(end)])
legend('h2-norm (Matlab)', 'h2-norm (MOR)','Frequency limited h2-norm','Location','SouthEast')
Example 2: L2-norm of unstable systems. This example shows how to compute the L2-norm for an unstable system and what it actually represents in terms of norms of the stable and unstable parts of the system.
% System composed by a stable and an unstable part
stable_part = ss(tf(1,[1, 2]));
unstab_part = ss(tf(1,[1, -1]));
H = stable_part + unstab_part;
% The H2-norm is infinite
mor.norm(H)
% The L2-norm is finite
mor.norm(H, 'L2')
% and it is equal to the sqrt of the squared sum of the H2-norm of the
% stable part and the H2-norm of the mirror of the unstable part
mirrored = ss(tf(1,[1, 1]));
sqrt(mor.norm(stable_part)^2 + mor.norm(mirrored)^2)
This example gives an overview of the norms for input-output data and how some of them are related to the norm of the underlying system.
rng(3)
H = rss(20,2,3,1);
H.D = 0;
fprintf('h2-norm of the model: %.3f\n',mor.norm(H))
fprintf('hinf-norm of the model: %.3f\n',norm(H,inf))
% Sampling the transfer function
w = logspace(-2,2,100);
h = freqresp(H,w);
% Pointwise norms of the data
fprintf('Mean square Frobenius norm of the data: %.3f\n',mor.norm({w,h},2))
fprintf('Pointwise 2-norm of the data: %.3f\n',mor.norm({w,h},inf))
% System related norms of the data
fprintf('Approximation of the L2-norm from the data: %.3f\n',mor.norm({w, h}, 'l2')) % Should be 'close' to the h2 norm
fprintf('Approximation of the Linf-norm from the data: %.3f\n',mor.norm({w, h}, 'linf')) % Should be 'close' to the hinf norm