图表 Latex (MPC 结构)

图表 Latex (MPC 结构)

我想在 Latex 中重新创建这个图形,以便可以做一些小的修改:

在此处输入图片描述

有人知道怎么做吗?我试过使用https://www.mathcha.io/,但它实际上并没有起作用。

干杯

答案1

您可以开始学习我强烈推荐的 pgf/tikz,或者您必须依赖导出 pgfplots 和/或 tikzpictures 的工具。如果您更喜欢使用此类工具,我真的认为您应该重新考虑。

mathcha.io 可以很好地制作出您展示的图形。您从中获得的代码可能并不理想,但您可以稍后清理它。

我之前只看过一次 mathcha.io,并没有真正用过它。这是我玩了半个小时后得到的:

mathcha.io 图片

它生成的代码可能并不理想。无论如何,它如下所示:

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,349); %set diagram left start at 0, and has height of 349

%Straight Lines [id:da43231875891590654] 
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 }  ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}]  (120.33,84) -- (354.83,84) ;
%Shape: Rectangle [id:dp319666920607797] 
\draw  [color={rgb, 255:red, 223; green, 223; blue, 223 }  ,draw opacity=1 ][fill={rgb, 255:red, 223; green, 223; blue, 223 }  ,fill opacity=1 ] (0,10) -- (120,10) -- (120,310) -- (0,310) -- cycle ;
%Shape: Axis 2D [id:dp8750863888202858] 
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][line width=0.75]  (0,259) -- (610,259)(120.33,20) -- (120.33,290) (603,254) -- (610,259) -- (603,264) (115.33,27) -- (120.33,20) -- (125.33,27) (140.33,254) -- (140.33,264)(160.33,254) -- (160.33,264)(180.33,254) -- (180.33,264)(200.33,254) -- (200.33,264)(220.33,254) -- (220.33,264)(240.33,254) -- (240.33,264)(260.33,254) -- (260.33,264)(280.33,254) -- (280.33,264)(300.33,254) -- (300.33,264)(320.33,254) -- (320.33,264)(340.33,254) -- (340.33,264)(360.33,254) -- (360.33,264)(380.33,254) -- (380.33,264)(400.33,254) -- (400.33,264)(420.33,254) -- (420.33,264)(440.33,254) -- (440.33,264)(460.33,254) -- (460.33,264)(480.33,254) -- (480.33,264)(500.33,254) -- (500.33,264)(520.33,254) -- (520.33,264)(540.33,254) -- (540.33,264)(560.33,254) -- (560.33,264)(580.33,254) -- (580.33,264)(100.33,254) -- (100.33,264)(80.33,254) -- (80.33,264)(60.33,254) -- (60.33,264)(40.33,254) -- (40.33,264)(20.33,254) -- (20.33,264)(115.33,239) -- (125.33,239)(115.33,219) -- (125.33,219)(115.33,199) -- (125.33,199)(115.33,179) -- (125.33,179)(115.33,159) -- (125.33,159)(115.33,139) -- (125.33,139)(115.33,119) -- (125.33,119)(115.33,99) -- (125.33,99)(115.33,79) -- (125.33,79)(115.33,59) -- (125.33,59)(115.33,39) -- (125.33,39)(115.33,279) -- (125.33,279) ;
\draw [color={rgb, 255:red, 74; green, 74; blue, 74 }  ,opacity=1 ]  ;
%Straight Lines [id:da12584573846252511] 
\draw [color={rgb, 255:red, 74; green, 74; blue, 74 }  ,draw opacity=1 ][line width=1.5]    (120.33,59) -- (120.33,161) ;
%Straight Lines [id:da7551044568040332] 
\draw [color={rgb, 255:red, 74; green, 74; blue, 74 }  ,draw opacity=1 ][line width=1.5]    (120.33,59) -- (610.33,59) ;
%Straight Lines [id:da6942844874543851] 
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 }  ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}]  (120.33,40) -- (330.83,40) ;
%Straight Lines [id:da051266162746494315] 
\draw [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ]   (120.33,218.79) -- (141.08,218.71) -- (141.08,189.46) -- (159.83,189.46) -- (159.83,168.46) -- (180.83,168.46) -- (180.83,203.46) -- (200.83,203.46) -- (200.83,218.71) -- (594.83,218.71) ;
\draw [shift={(594.83,218.71)}, rotate = 0] [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ][fill={rgb, 255:red, 65; green, 117; blue, 5 }  ,fill opacity=1 ][line width=0.75]      (0, 0) circle [x radius= 1.34, y radius= 1.34]   ;
\draw [shift={(120.33,218.79)}, rotate = 359.78] [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ][fill={rgb, 255:red, 65; green, 117; blue, 5 }  ,fill opacity=1 ][line width=0.75]      (0, 0) circle [x radius= 1.34, y radius= 1.34]   ;
%Straight Lines [id:da48661046345443937] 
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 }  ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}]  (120.33,168.46) -- (610.33,169.08) ;
%Straight Lines [id:da5957415780841664] 
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 }  ,draw opacity=1 ]   (326.83,87.17) -- (349,95) ;
%Straight Lines [id:da5568742044783566] 
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 }  ,draw opacity=1 ]   (301.83,163.17) -- (324.83,149.17) ;
%Straight Lines [id:da12299314631265124] 
\draw [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ]   (366.83,213.17) -- (391.83,202.17) ;

% Text Node
\draw (60,29.5) node  [font=\small,color={rgb, 255:red, 74; green, 74; blue, 74 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{50.059356pt}\setlength\topsep{0pt}
\begin{center}
{\footnotesize Vergangenheit}
\end{center}

\end{minipage}};
% Text Node
\draw (200,29.5) node  [font=\small,color={rgb, 255:red, 74; green, 74; blue, 74 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{27.200000000000003pt}\setlength\topsep{0pt}
\begin{center}
{\footnotesize Zukunft}
\end{center}

\end{minipage}};
% Text Node
\draw (60,116.17) node  [font=\small,color={rgb, 255:red, 74; green, 74; blue, 74 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{50.864000000000004pt}\setlength\topsep{0pt}
\begin{center}
{\footnotesize Sollwertverlauf}\\{\footnotesize \textit{{\fontfamily{pcr}\selectfont \textbf{w} (·|k)}}}
\end{center}

\end{minipage}};
% Text Node
\draw (376.21,105.17) node  [font=\scriptsize,color={rgb, 255:red, 208; green, 2; blue, 27 }  ,opacity=0.6 ] [align=left] {\begin{minipage}[lt]{82.97156pt}\setlength\topsep{0pt}
\begin{center}
Sollbereich\\$ $$\displaystyle y_{min} \ \leq \ y( \cdotp |k) \ \leq \ y_{max}$
\end{center}

\end{minipage}};
% Text Node
\draw (512.21,104.17) node  [font=\scriptsize,color={rgb, 255:red, 245; green, 196; blue, 35 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{63.01335600000001pt}\setlength\topsep{0pt}
\begin{center}
Referenztrajektorie\\$ $$\displaystyle r\ ( \cdotp |k)$
\end{center}

\end{minipage}};
% Text Node
\draw (462.21,31.17) node  [font=\scriptsize,color={rgb, 255:red, 74; green, 144; blue, 226 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{102.29444000000001pt}\setlength\topsep{0pt}
\begin{center}
optimaler Verlauf der Prädiktion\\{\footnotesize $ $$\displaystyle \hat{y} \ ( \cdotp |k)$}
\end{center}

\end{minipage}};
% Text Node
\draw (383.21,149.17) node  [font=\scriptsize,color={rgb, 255:red, 208; green, 2; blue, 27 }  ,opacity=0.6 ] [align=left] {\begin{minipage}[lt]{82.05356pt}\setlength\topsep{0pt}
\begin{center}
Stellgrößenbeschreibung\\$ $$\displaystyle u_{max}$
\end{center}

\end{minipage}};
% Text Node
\draw (7,200.4) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 74; green, 74; blue, 74 }  ,opacity=1 ]  {$\Delta u( k+1|k) \ \leq \Delta u_{max}$};
% Text Node
\draw (428.21,201.71) node  [font=\scriptsize,color={rgb, 255:red, 245; green, 196; blue, 35 }  ,opacity=1 ] [align=left] {\begin{minipage}[lt]{83.64pt}\setlength\topsep{0pt}
\begin{center}
\textcolor[rgb]{0.25,0.46,0.02}{optimale Stellgrößenfolge}\\\textcolor[rgb]{0.25,0.46,0.02}{$ $$\displaystyle u\ ( \cdotp |k)$}
\end{center}

\end{minipage}};


\end{tikzpicture}

相关内容