將 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}

相關內容