1% r = CheckDRAPRepresentation(H, prec)
3% Checks
if the input matrixes define a discrete time RAP.
5% Matrices H0 and H1 must have the same size, the dominant
6% eigenvalue of H0
is real and less than 1, and the rowsum of
7% H0+H1
is 1 (up to the numerical precision).
11% H0 : matrix, shape (M,M)
12% The H0 matrix of the DRAP to check
13% H1 : matrix, shape (M,M)
14% The H1 matrix of the DRAP to check
15% prec : double, optional
16% Numerical precision, the default value
is 1e-14
21% The result of the check
23function r=CheckDRAPRepresentation(d0, d1, prec)
25 global BuToolsVerbose;
26 global BuToolsCheckPrecision;
27 if isempty(BuToolsCheckPrecision)
28 BuToolsCheckPrecision = 1e-12;
31 if ~exist(
'prec',
'var')
32 prec = BuToolsCheckPrecision;
36 if size(d0,1) ~= size(d1,1) || size(d0,2) ~= size(d1,2) || size(d0,1) ~= size(d0,2)
38 fprintf('CheckDRAPRepresentation: D0 and D1 have different sizes!\n');
43 if any(abs(sum(d0+d1,2)-1) > prec)
45 fprintf('CheckDRAPRepresentation: A rowsum of D0+D1
is not 1 (at precision %g)!\n',prec);
50 ev = EigSort(eig(d0));
55 fprintf('CheckDRAPRepresentation: The dominant eigenvalue of the D0
is complex!\n');
62 fprintf('CheckDRAPRepresentation: The dominant eigenvalue of D0
is greater than 1!\n');
67 if sum(abs(ev(1:end))==abs(maxev)) > 1
69 fprintf('CheckDRAPRepresentation Warning: D0 has more than one eigenvalue with the same absolute value as the dominant eigenvalue!\n');