带因式分解的高斯消元法

带因式分解的高斯消元法

我想在 Latex 中绘制此图。我该怎么做? 在此处输入图片描述

答案1

您可以使用groupplots库来pgfplots形成子图网格。然后,您可以使用选项area style填充图形下方的区域并const plot更轻松地绘制锯齿线。

\documentclass{beamer}

\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepackage[tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}
\begin{tikzpicture}
  \begin{groupplot} [
      group style={group size = 2 by 2,},
      area style,
      hide axis,
      enlarge x limits=false,
      xmax=5,xmin=0,ymax=5,ymin=0,
    ]
    \nextgroupplot[const plot,]
    \addplot[mark=none,draw=black,fill=green!64!blue] coordinates {
      (0,5) (4,5)
    } \closedcycle
    ;
    \addplot[mark=none,draw=black,fill=magenta] coordinates {
      (4,5) (5,5)
    } \closedcycle;
    \addplot[mark=none] coordinates {(3,3)}
    node[pos=0] {$A$};
    \addplot[mark=none] coordinates {(4.5,3)}
    node[pos=0] {$b$};

    \nextgroupplot[const plot,]
    \addplot[mark=none,draw=black,fill=green!64!blue] coordinates {
      (0,5) (4,5)
    } \closedcycle
    ;
    \addplot[mark=none,draw=black,fill=magenta] coordinates {
      (4,5) (5,5)
    } \closedcycle;
    \addplot[mark=none,draw=black,fill=white] coordinates {
      (0,4) (1,4)
    } \closedcycle;
    \addplot[mark=none] coordinates {(3,3)}
    node[pos=0] {$A^{(1)}$};
    \addplot[mark=none] coordinates {(4.5,3)}
    node[pos=0] {$b^{(1)}$};

    \nextgroupplot[const plot,]
    \addplot[mark=none,draw=black,fill=green!64!blue] coordinates {
      (0,5) (4,5)
    } \closedcycle
    ;
    \addplot[mark=none,draw=black,fill=magenta] coordinates {
      (4,5) (5,5)
    } \closedcycle;
    \addplot[mark=none,draw=black,fill=white] coordinates {
      (0,4) (1,3) (2,3)
    } \closedcycle;
    \addplot[mark=none] coordinates {(3.5,3)}
    node[pos=0] {$A^{(2)}$};
    \addplot[mark=none] coordinates {(4.5,3)}
    node[pos=0] {$b^{(2)}$};

    \nextgroupplot[const plot,]
    \addplot[mark=none,draw=black,fill=green!64!blue] coordinates {
      (0,5) (4,5)
    } \closedcycle
    ;
    \addplot[mark=none,draw=black,fill=magenta] coordinates {
      (4,5) (5,5)
    } \closedcycle;
    \addplot[mark=none,draw=black,fill=white] coordinates {
      (0,4) (1,3) (2,3) (2,2) (3,2)
    } \closedcycle;
    \addplot[mark=none] coordinates {(3.5,3)}
    node[pos=0] {$A^{(3)}$};
    \addplot[mark=none] coordinates {(4.5,3)}
    node[pos=0] {$b^{(3)}$};

  \end{groupplot}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容