About"blkdiag". Dimensions with subscripts do not match

This seems to be the same bug with blkdiag as occurred in Where is the mistake of this Convex optimization problem? .

My workaround there, as here, is to form the required expression by concatenation rather than using blkdiag .

else
   W(:,:,i) = [W1(:,:,i) zeros(N-2,2);zeros(2,N-2) zeros(2)];

Note: of course, the last block row can be combined into zeros(2,N), but I wrote it as I did for readability.

This executed without error for me, although unbounded without adding what are presumably your additional unprovided constraints.

1 Like