![更改矩阵图形布局](https://linux22.com/image/259715/%E6%9B%B4%E6%94%B9%E7%9F%A9%E9%98%B5%E5%9B%BE%E5%BD%A2%E5%B8%83%E5%B1%80.png)
我有一个图,我正在写一些矩阵,我想要类似的东西
但我明白这一点,如何改变它?
我有
\begin {figure}[h]
\centering
\small
\textbf{X}
\[\left( \begin{array}{cccc}
x_{11} & x_{12} &\cdots & x_{1d} \\
x_{21} & x_{22} &\cdots & x_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
x_{n1} & x_{n2} &\cdots & x_{nd} \end{array} \right)\]
\[ \boldsymbol{n \times d} \]
\textbf{Data}
\Huge
\[\downarrow \]
\small
\textbf{\[\rho\]}
\[\left( \begin{array}{cccc}
\rho_{11} & \rho_{12} &\cdots & \rho_{1d} \\
\rho_{21} & \rho_{22} &\cdots & \rho_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
\rho_{d1} & \rho_{d2} &\cdots & \rho_{dd} \end{array} \right)\]
\[ \boldsymbol{d \times d} \]
\textbf{Correlation Matrix}
\Huge
\[\downarrow \]
\small
\textbf{U}
\[\left( \begin{array}{ccc}
u_{11} & \cdots & u_{1d} \\
\vdots & \ddots & \vdots \\
u_{d1} & \cdots & u_{dd} \end{array} \right)\]
\[ \boldsymbol{d \times d} \]
\textbf{EigenVectors}
\textbf{\[\Sigma\]}
\[\left( \begin{array}{ccc}
\sigma_{11} & 0 & \cdots \\
0 & \ddots & \vdots \\
\vdots & \cdots & \sigma_{dd} \end{array} \right)\]
\[ \boldsymbol{d \times d} \]
\textbf{Singular Values}
\caption{ Steps in matrix notation of SVD}
\label{fig:stpeE}
\end{figure}
答案1
也许这可以帮助:
\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\begin {figure}[h]
\[
\begin{array}{ccc}
&
\textbf{X}
&\\
&
\left( \begin{array}{cccc}
x_{11} & x_{12} &\cdots & x_{1d} \\
x_{21} & x_{22} &\cdots & x_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
x_{n1} & x_{n2} &\cdots & x_{nd} \end{array} \right)
&\\
&
\boldsymbol{n \times d}
&\\[2ex]
&
\textbf{Data}
&\\
&
\downarrow
&\\
&
\resizebox{12pt}{!}{$\rho$}
&\\
&
\left( \begin{array}{cccc}
\rho_{11} & \rho_{12} &\cdots & \rho_{1d} \\
\rho_{21} & \rho_{22} &\cdots & \rho_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
\rho_{d1} & \rho_{d2} &\cdots & \rho_{dd} \end{array} \right)
&\\
&
\boldsymbol{d \times d}
&\\[2ex]
&
\textbf{Correlation Matrix}
&\\
&
\downarrow
&\\
\textbf{U} & \textbf{S} & \mathbf{V^T}\\
\left( \begin{array}{ccc}
u_{11} & \cdots & u_{1d} \\
\vdots & \ddots & \vdots \\
u_{d1} & \cdots & u_{dd} \end{array} \right)
&
\left( \begin{array}{ccc}
s_{11} & \cdots & s_{1d} \\
\vdots & \ddots & \vdots \\
s_{d1} & \cdots & s_{dd} \end{array} \right)
&
\left( \begin{array}{ccc}
v_{11} & \cdots & v_{1d} \\
\vdots & \ddots & \vdots \\
v_{d1} & \cdots & v_{dd} \end{array} \right)
\\
\boldsymbol{d \times d}& \boldsymbol{d \times d}&\boldsymbol{d \times d}\\
\text{Eigen Values} & \text{Singular Values} & \text{Eigen Vectors}
\end{array}
\]
\caption{ Steps in matrix notation of SVD}
\label{fig:stpeE}
\end{figure}
\end{document}
这个想法是使用 来array
创建图表本身。您可以通过添加空行或 来调整垂直空间\\[<length>]
。
答案2
以下是另一个答案:
为了获得大箭头,我定义了一个新命令。此外,我使用环境创建矩阵pmatrix
。值得查找此环境。通过为矩阵定义自己的环境:
\newenvironment{mymatrix}{\begin{pmatrix}}{\end{pmatrix}}
您可以非常轻松地将括号更改为大括号或无括号或其他样式。
为了获得底部的三个矩阵,我将其嵌套在另一个array
环境中。这将有助于在每个矩阵的上方和下方进行标记。
\documentclass{article}
\usepackage{amsmath}
\newcommand{\Hdownarrow}{\mbox{\Huge$\downarrow$}}
\newenvironment{mymatrix}{\begin{pmatrix}}{\end{pmatrix}}
\pagestyle{empty}
\begin{document}
\begin {figure}[h]
\centering
\small
\[
\begin{array}{@{}c@{}}
\text{\textbf{X}} \\
\begin{mymatrix}
x_{11} & x_{12} &\cdots & x_{1d} \\
x_{21} & x_{22} &\cdots & x_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
x_{n1} & x_{n2} &\cdots & x_{nd}
\end{mymatrix}
\\[2ex]
\boldsymbol{n \times d} \\[4ex]
\text{\textbf{Data}} \\
\Hdownarrow \\
\rho \\
\begin{mymatrix}
\rho_{11} & \rho_{12} &\cdots & \rho_{1d} \\
\rho_{21} & \rho_{22} &\cdots & \rho_{2d} \\
\vdots & \vdots &\ddots & \vdots \\
\rho_{d1} & \rho_{d2} &\cdots & \rho_{dd}
\end{mymatrix}
\\
\boldsymbol{d \times d} \\
\text{\textbf{Correlation Matrix}} \\[2ex]
\Hdownarrow \\[3ex]
\begin{array}{ccc}
\text{\textbf{U}} & \text{\textbf{S}} & \text{\textbf{U}}\\
\begin{mymatrix}
u_{11} & \cdots & u_{1d} \\
\vdots & \ddots & \vdots \\
u_{d1} & \cdots & u_{dd}
\end{mymatrix}
&
\begin{mymatrix}
\sigma_{11} & 0 & \cdots \\
0 & \ddots & \vdots \\
\vdots & \cdots & \sigma_{dd}
\end{mymatrix}
&
\begin{mymatrix}
\sigma_{11} & 0 & \cdots \\
0 & \ddots & \vdots \\
\vdots & \cdots & \sigma_{dd}
\end{mymatrix}
\\
d \times d & d\times d & d\times d \\[2ex]
\text{\textbf{EigenVectors}} & \text{\textbf{Singular Values}} & \text{?}
\end{array}
\end{array}
\]
\caption{ Steps in matrix notation of SVD}
\label{fig:stpeE}
\end{figure}
\end{document}