This is the problem. Given a matrix B =
\begin{bmatrix} 6&-1&0\\-1&6&-1\\0&-1&6 \end{bmatrix}.
and
I = 3 x 3 identity matrix, how can I construct D = \begin{bmatrix} B&-I&0\\-I&B&-I\\0&-I&B \end{bmatrix}?
I know that B can be easily created using B = full(gallery('tridiag',3,[-1 6 -1])); Is there something similar for D?