将 Simulink 块转换为 TikZ 模型

将 Simulink 块转换为 TikZ 模型

有人知道 TikZ 代码如何使用这些方程式创建这个模型吗?

在此处输入图片描述

注意:无论图像中的线条和箭头是什么颜色,它们都必须是黑色且连续绘制。

非常感谢你们

答案1

您可以使用 SchemaBloc 包

\documentclass[border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{schemabloc}


\begin{document}

\begin{tikzpicture}
\sbEntree{r}
\sbComp*{compar}{r}                               
\sbRelier[$r$]{r}{compar}{}
\sbBloc{H1}{$\dfrac{1}{s+1}$}{compar}  
\sbRelier[$\varepsilon$]{compar}{H1}{}
\sbBloc{H2}{$\dfrac{1}{s+2}$}{H1}  
\sbRelier[]{H1}{H2}{}
\sbSortie[5]{Y}{H2}                              
\sbRelier[$y$]{H2}{Y}{}     
\sbRenvoi{H2-Y}{compar}{$y_m$}
\end{tikzpicture}

\end{document}

在此处输入图片描述

您可以尝试这里 https://fr.overleaf.com/read/mwrzbnqmmtmy

答案2

使用纯 TikZ:

\documentclass[tikz, margin=3.14159mm]{standalone}
\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                quotes}
\usepackage{amsmath}

\begin{document}
    \begin{tikzpicture}[auto,
node distance = 11mm and 9mm,
  start chain = A going right,
   arr/.style = {draw=#1, semithick, -Triangle},
 arr/.default = black,
   box/.style = {draw, minimum height=11mm, minimum width=22mm},
   dot/.style = {circle, fill, inner sep=2pt, outer sep=0pt, anchor=center},
   sum/.style = {circle, draw, minimum size=9mm}
                        ]
    \begin{scope}[nodes={on chain=A}]
\coordinate (in);
\node [sum] {};                     % A-2
\node [box] {$\dfrac{1}{s + 1}$};
\node [box] {$\dfrac{1}{s + 2}$};
\node [dot] {};                     % A-5
\coordinate (out);
    \end{scope}
\draw[arr=red]  (in) to ["$r$"] (A-2.west) node[right] {$+$}; 
\draw[arr]  (A-2)   edge["$e$"] (A-3)
            (A-3)   edge["$u$"] (A-4);
\draw[-]    (A-4) -- (A-5);
\draw[arr=red,dashed]   (A-5) node[above] {$y$} -- (out);
%
\coordinate[below=of A-5]   (aux);
\draw[arr] (A-5) -- (aux) -| (A-2.south) 
    node[below left] {$y_m$}
    node[above] {$-$};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

这就是我所寻找的:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}


\tikzstyle{block} = [draw, fill=blue!20, rectangle, 
    minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

\begin{tikzpicture}[auto, node distance=2cm,>=latex']

    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (controller) {$\frac{0.067\cdot \left(s + 6.51 \right)}{s}  $};
    \node [block, right of=controller, node distance=3cm] (system) {$\frac{357.67}{0.250 \cdot s + 1} \cdot \frac{1}{32}$};

    \draw [->] (controller) -- node[name=u] {$u$} (system);
    \node [output, right of=system] (output) {};
    %\node [block, below of=u] (measurements) {Measurements};
    \coordinate [below of=u] (measurements) {};

    \draw [draw,->] (input) -- node {$r$} (sum);
    \draw [->] (sum) -- node {$e$} (controller);
    \draw [->] (system) -- node [name=y] {$y$}(output);
    \draw [-] (y) |- (measurements);
    \draw [->] (measurements) -| node[pos=1.00] {$-$} 
        node [near end] {$y_m$} (sum);

\end{tikzpicture}

\end{document}

相关内容