I have a matrix $A$ of $288$ rows by $1$ column (vector). I am creating another matrix $B$ such that the elements in the first six row of matrix $A$ is average to form the first element in the first row of matrix $B$. The elements in the $7$th to $12$th row of matrix $A$ is average to form the element in the second row of matrix $B$, and so on in six step till matrix B is form as $48$ by $1$ matrix (vector). Please I need a mathematical equation to show how matrix $B$ is form from matrix $A$. Thank you. ?
3 Answers
Let $$ A = \begin{bmatrix} a_1 \\ a_2 \\ \vdots \\ a_{288} \end{bmatrix} $$ be given. For each $1 \leq i \leq 48$, set $b_i := \frac{1}{6}\sum_{j=6(i-1)+1}^{6i} a_i$ and take $$ B := \begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_{48} \end{bmatrix}. $$
- 10,668
The desired $48 \times 288$ matrix is
$$\frac 16 \begin{bmatrix} 1_6^\top & 0_6^\top & \cdots & 0_6^\top\\ 0_6^\top & 1_6^\top & \cdots & 0_6^\top\\ \vdots & \vdots & \ddots & \vdots\\ 0_6^\top & 0_6^\top & \cdots & 1_6^\top\end{bmatrix} = \frac 16 \left( \mathrm I_{48} \otimes 1_6^\top \right)$$
In MATLAB or NumPy, use function kron to compute the Kronecker product (denoted by $\otimes$).
$B = C A$ where $C$ is the $48 \times 288$ matrix with $C_{i,j} = 1/6$ for $6i-5 \le j \le 6 i$ and $0$ everywhere else.
- 448,999