Help implementing this matrix

Here is two possible options, although I am not entirely happy with it:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
%
\begin{document}
\begin{align*}
\begin{bmatrix}
p_1 & 0 & 0  & \multicolumn{2}{c}{\cdots} & 0\\
0 & p_2 &  0     &  \multicolumn{2}{c}{\cdots}  & 0\\ 
  0 & 0 &        &        &  \\
\vdots & \vdots  & \Huge{\mathbf{I}} &   & 0 & 0\\
  0 & 0 &        &        &  \\
0 & 0 & \cdots   & 0 &p_3 & 0\\
0 & 0 & \cdots   & 0 &0 & p_4 
\end{bmatrix}\begin{bmatrix}
    1\\
    1\\
    d_1
    \\
    \vdots\\
    d_N\\
    1\\
    1\\ 
\end{bmatrix}
\end{align*}
Another option:
\begin{align*}
\begin{bmatrix}
p_1 & 0 & 0  & \cdots& 0 & 0\\
0 & p_2 &  0     & \cdots  &0  & 0\\ 
  0 & 0 &        &        & 0  & 0 \\
\vdots & \vdots  & \multicolumn{2}{c}{\Huge{\mathbf{I}}}    & \vdots & \vdots\\
  0 & 0 &        &   &0    & 0  \\
0 & 0 & \cdots   & 0 &p_3 & 0\\
0 & 0 & \cdots   & 0 &0 & p_4 
\end{bmatrix}\begin{bmatrix}
    1\\
    1\\
    d_1
    \\
    \vdots\\
    d_N\\
    1\\
    1\\ 
\end{bmatrix}
\end{align*}
\end{document}

You could do the following:

Code

\documentclass[varwidth]{standalone}
\usepackage{amsmath}
\newcommand*{\mat}{\mathbf}
\begin{document}
\begin{equation*}
\begin{bmatrix}
    p_1    & 0      & \ldots        & \ldots & \ldots        & 0      & 0      \\
    0      & p_2    & \ldots        & \ldots & \ldots        & 0      & 0      \\
    \vdots & \vdots & \mat{I}_{1,1} &        &               & \vdots & \vdots \\
    \vdots & \vdots &               & \ddots &               & \vdots & \vdots \\
    \vdots & \vdots &               &        & \mat{I}_{N,N} & \vdots & \vdots \\
    0      & 0      & \ldots        & \ldots & \ldots        & p_3    & 0      \\
    0      & 0      & \ldots        & \ldots & \ldots        & 0      & p_4
\end{bmatrix}
%
\begin{bmatrix}
    1 \\ 1 \\ d_1 \\ \vdots \\ d_N \\ 1 \\ 1
\end{bmatrix}
%
\text{ or }
%
\begin{bmatrix}
    1 \\ 1 \\ d_1 \vphantom{\vdots} \\ \vdots \\ d_N \vphantom{\vdots} \\ 1 \\ 1
\end{bmatrix}
\label{Eq:matrix}
\end{equation*}
\end{document}

Output

enter image description here


It's a not even block diagonal it's a diagonal matrix so you can skip the matrix version

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\diagfences}{(}{)}
\newcommand{\diag}{\operatorname{diag}\diagfences}
%
\begin{document}
\[
\diag{p_1,p_2,\underbracket[0.5pt][2pt]{1,1,\ldots,1,1}_{N},p_3,p_4}
\begin{bmatrix}
    1\\
    1\\
    d_1
    \\
    \vdots\\
    d_N\\
    1\\
    1\\ 
\end{bmatrix}
\label{Eq:matrix}
\]
\end{document}

enter image description here