In this example, we use the weighted sum of Frobenius norms to design optimal block sparse feedback
gains. To compare with elementwise sparsity, we also use the weighted norm for optimal
sparse feedback design. In both cases, we set ,
and select logarithmically-spaced points for

N = 5;
nn = 3;
mm = 1;
a = ones(1,nn);
b = 1.5*(sec(pi/nn))*a;
Aa = -diag(a) + diag(b(2:nn),-1);
Aa(1,nn) = -b(1);
Bb1 = diag(b);
Bb2 = zeros(nn,1);
Bb2(1) = b(1);
Ad = toeplitz([1 0 0 1 0 0 1 0 0 1 0 0 1 0 0]);
for i = 1 : N
for j = 1 : N
if i ~= j
cij = 0.5 * ( i - j );
else
cij = 0;
end
Ad( nn*(i-1)+1 : nn*i, nn*(j-1)+1 : nn*j) = cij * eye(nn);
end
end
d = sum(Ad,2);
L = Ad - diag(d);
A = kron(eye(N), Aa) - L;
B1 = kron(eye(N), Bb1);
B2 = kron(eye(N), Bb2);
Q = eye(nn*N);
R = eye(N);
options_blkwl1 = struct('method','blkwl1','gamval', ...
logspace(-1,log10(5),50),'rho',100,'maxiter',1000,'blksize',[1 3], ...
'reweightedIter',1);
tic
solpath_blkwl1 = lqrsp(A,B1,B2,Q,R,options_blkwl1);
toc
options_wl1 = struct('method','wl1','gamval', ...
logspace(-1,log10(5),50),'rho',100,'maxiter',1000,'blksize',[1 1], ...
'reweightedIter',1);
tic
solpath_wl1 = lqrsp(A,B1,B2,Q,R,options_wl1);
toc

The following example illustrates two feedback gains resulting from the block sparse and sparse feedback
designs. These feedback gains have close quadratic performance,
and the same number of nonzero elements, but different number of nonzero block submatrices.
Furthermore, as illustrated below, the optimal sparse feedback gain requires more communication
links than the optimal block sparse feedback gain.