-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblkbandlmivar.m
35 lines (30 loc) · 1.38 KB
/
blkbandlmivar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File : blkbandlmivar.m %
% %
% Author : Tobias Holicki %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Returns a nonsymmtric LMI variable with block band structure.
% Each block is square of dimension blksize and we have numdiagonalblocks
% on the diagonal of this variable.
%
function [M, n, sM] = blkbandlmivar(blksize, numdiagonalblocks, ...
numcurrentvars)
% Some sanity checks
arguments
blksize (1, 1) {mustBeInteger, mustBePositive}
numdiagonalblocks (1, 1) {mustBeInteger, mustBePositive}
numcurrentvars (1, 1) {mustBeInteger, mustBePositive}
end
% Abbreviation
h = numdiagonalblocks;
% Build a matrix indicating the desired band structure
I = diag(ones(h, 1)) + diag(ones(h-1, 1), 1) + diag(ones(h-1, 1), -1);
I = kron(I, ones(blksize));
% Now generate a matrix for use within LMILab
numnewvars = length(find(I == 1)); % Number variables that we will add
newvars = numcurrentvars + (1:numnewvars);
I(I == 1) = newvars;
% Generate new structured variable
[M, n, sM] = lmivar(3, I);
end