创建马尔可夫链图

创建马尔可夫链图

我有以下问题。我想创建以下图表在此处输入图片描述

到目前为止,我知道如何用 latex 创建图表。但我不知道如何插入系列点。这是我的解决方案。它看起来与上面的图表相似,但没有点。希望有人能帮助我

\documentclass{book}
\usepackage{amsmath, amssymb, amsthm, dsfont, bbm}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\begin{document}
\[
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=4cm,
                    semithick]
  \tikzstyle{every state}=[fill=red,draw=none,text=white]

  \node[state]         (A)                    {$\{\omega\}$};
  \node[state]         (B) [below of=A] {$A_{2}(1)$};
  \node[state]         (C) [below of=B] {$A_{1}(1)$};
  \node[state]         (D) [below of=C] {$\{\omega\}$};
  \node[state]         (E) [right of=A] {$\{\omega\}$};
  \node[state]         (F) [right of=B] {$A_{2}(2)$};
  \node[state]         (G) [right of=C] {$A_{1}(2)$};
  \node[state]         (H) [right of=D] {$\{\omega\}$};
  \node[state]         (I) [right of=E] {$\{\omega\}$};
  \node[state]         (J) [right of=F] {$A_{2}(m)$};
  \node[state]         (K) [right of=G] {$A_{1}(m)$};
  \node[state]         (L) [right of=H] {$\{\omega\}$};
  \node[state]         (M) [right of=J] {$A_{2}(m+1)$};


  \path (B) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (A)
            edge [loop left]  node {$\QAt$}                         (B)
            edge              node {$\QAto$}                        (C)
        (C) edge [loop left]  node {$\QAo$}                         (C)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (D)
            edge [right]      node {$\QAot$}                        (F)
        (F) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (E)
            edge [loop left]  node {$\QAt$}                         (F)
            edge              node {$\QAto$}                        (G)
        (G) edge [loop left]  node {$\QAo$}                         (G)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (H)
        (J) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (I)
            edge [loop left]  node {$\QAt$}                         (J)
            edge              node {$\QAto$}                        (K)
        (K) edge [loop left]  node {$\QAo$}                         (K)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (L)
            edge [right]      node {$\QAot$}                        (M)
        (M) edge [loop left]  node {$\I$}                           (M);
\end{tikzpicture}
\]
\end{document} 

我的图表如下所示 在此处输入图片描述 我定义了以下命令:

\newcommand{\QAt}{\mathbf{Q}_{A_{2}A_{2}}}
\newcommand{\QAo}{\mathbf{Q}_{A_{1}A_{1}}}
\newcommand{\QAot}{\mathbf{Q}_{A_{1}A_{2}}}
\newcommand{\QAto}{\mathbf{Q}_{A_{2}A_{1}}}
\newcommand{\QAtC}{\mathbf{Q}_{A_{2}C}}
\newcommand{\I}{\mathbf{I}}

我如何创建图中的三个点?

答案1

欢迎来到 TeX.SE!这很简单。但是,这个答案是告诉你,你的相对定位方式有点过时了,最好使用库来实现positioning这一点,任务会变得更加简单。同样,arrows被 取代arrows.meta

\documentclass{book}
\usepackage{amsmath, amssymb, amsthm, dsfont, bbm}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,automata,positioning}
\newcommand{\QAt}{\mathbf{Q}_{A_{2}A_{2}}}
\newcommand{\QAo}{\mathbf{Q}_{A_{1}A_{1}}}
\newcommand{\QAot}{\mathbf{Q}_{A_{1}A_{2}}}
\newcommand{\QAto}{\mathbf{Q}_{A_{2}A_{1}}}
\newcommand{\QAtC}{\mathbf{Q}_{A_{2}C}}
\newcommand{\I}{\mathbf{I}}
\begin{document}
\[
\begin{tikzpicture}[->,>=Stealth,shorten >=1pt,auto,node distance=2cm,
                    semithick]
  \tikzset{every state/.append style={fill=red,draw=none,text=white}}

  \node[state]         (A)                    {$\{\omega\}$};
  \node[state]         (B) [below=of A] {$A_{2}(1)$};
  \node[state]         (C) [below=of B] {$A_{1}(1)$};
  \node[state]         (D) [below=of C] {$\{\omega\}$};
  \node[state]         (F) [right=of B] {$A_{2}(2)$};
  \node[state]         (E) [above=of F] {$\{\omega\}$};
  \node[state]         (G) [below=of F] {$A_{1}(2)$};
  \node[state]         (H) [below=of G] {$\{\omega\}$};
  \node[state]         (J) [right=of F] {$A_{2}(m)$};
  \node[state]         (I) [above=of J] {$\{\omega\}$};
  \node[state]         (K) [below=of J] {$A_{1}(m)$};
  \node[state]         (L) [below=of K] {$\{\omega\}$};
  \node[state]         (M) [right=of J] {$A_{2}(m+1)$};


  \path (B) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (A)
            edge [loop left]  node {$\QAt$}                         (B)
            edge              node {$\QAto$}                        (C)
        (C) edge [loop left]  node {$\QAo$}                         (C)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (D)
            edge [right]      node {$\QAot$}                        (F)
        (F) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (E)
            edge [loop left]  node {$\QAt$}                         (F)
            edge              node(aux) {$\QAto$}                        (G)
        (G) edge [loop left]  node {$\QAo$}                         (G)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (H)
        (J) edge              node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (I)
            edge [loop left]  node {$\QAt$}                         (J)
            edge              node {$\QAto$}                        (K)
        (K) edge [loop left]  node {$\QAo$}                         (K)
            edge              node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (L)
            edge [right]      node {$\QAot$}                        (M)
        (M) edge [loop left]  node {$\I$}                           (M);
 \node[right=2mm of aux,font=\bfseries\Huge]{\dots};        
\end{tikzpicture}
\]
\end{document}

在此处输入图片描述

相关内容