TikZ 引脚对齐和双线箭头

TikZ 引脚对齐和双线箭头

我有以下内容tikzpicture

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}     % Support for french language
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{decorations.markings,shapes,arrows}

\begin{document}

\tikzstyle{block} = [draw, rectangle, 
    minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-, thin, black, dashed}, pin distance = 2cm]
\tikzstyle{amp} = [regular polygon, regular polygon sides=3,
                  draw, fill=white, text width=1em,
                  inner sep=0.35mm, outer sep=0mm,
                  shape border rotate=-90]
\tikzstyle{line} = [draw, thick, -]

% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=2cm,>=latex', every text node part/.style={align=center}]
    \node[block, pin={[pinstyle]above:p},
            node distance=3cm] (gp) {Générateur \\ périodique};
    \node[block, below = 2cm of gp] (ga) {Générateur \\ aléatoire};
    \node[amp, pin={[pinstyle]above:$\sigma$},
            yshift = -1.5cm, right = 2 cm  of gp] (g) {};

    \draw[line] (g.west) -- ++(-0.5cm,0) coordinate(r1){};
    \draw[line] (ga.east) -- ++(1cm,0) -- ++(0,1cm) coordinate(b1){};
    \draw[line] (gp.east) -- ++(1cm,0) -- ++(0,-1cm)coordinate(a1){};
    \fill (a1) circle[radius=2pt];
    \fill (b1) circle[radius=2pt];
    \fill (r1) circle[radius=2pt];
    \draw[line, rounded corners = 2pt]  (r1)  -- (a1);
    \draw[thick,->=stealth] (g.east) -- ++(1cm,0);

    \node[block, pin={[pinstyle]above:$|a_p(i)|$},
            right = 1cm of g] (tf) {$\frac{1}{1+\sum_{i=1}^p a_p(i)z^{-i}}$};
    \node [output, right of=tf] (output) {};
    \draw[thick, ->=stealth] (tf.east) -- ++(1cm, 0) node[above] () {$x(n)$};
\end{tikzpicture}
\end{document}

得到如下图像:

自回归系统

但是,还有一些我不知道如何执行的操作:

  1. 我想垂直对齐带有符号的虚线\sigma,并与带有符号|a_p(i)|的虚线垂直对齐p

  2. 我想|a_p(i)|用箭头双线代替虚线单线

  3. 我想添加第四条垂直虚线,以开关符号(在r1a1坐标之间)开始,并带有符号V/NV并与其他 3 条符号垂直对齐。

欢迎任何意见或建议。

答案1

像这样?

在此处输入图片描述

我对你的代码做了很大的修改......

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}     % Support for french language
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                calc, 
                decorations.markings,
                positioning, 
                shapes}

\begin{document}
    \begin{tikzpicture}[
node distance = 2cm and 1cm,
            > = {Straight Barb[angle=60:2pt 3]}, 
 block/.style = {rectangle, draw, 
                 minimum height=3em, minimum width=6em,
                 align=center},
    amp/.style = {regular polygon, regular polygon sides=3,
                  draw, fill=white, text width=1em, outer sep=0mm,
                  shape border rotate=-90},
   switch/.pic = {\draw (0, 3mm) coordinate (-in1) 
                     -- (3mm,0)  coordinate[midway] (-s)
                                 coordinate (-out);
                  \path (0,-3mm) coordinate (-in2);
                  \fill[black]  (-in1) circle (0.5mm)
                                (-in2) circle (0.5mm)
                                (-out) circle (0.5mm);
                  },
pinstyle/.style= {pin edge={<-,thin, black, dashed}, pin distance = 11mm},                      
    lbl/.style = {text depth=0.3 ex, above}
                    ]                        
\node[block, 
      pin={[pinstyle, name=pin-p]above:$p$}] (gp) {Générateur \\ périodique};
\node[block, below=of gp] (ga) {Générateur \\ aléatoire};
\pic [right=of $(gp.east)!0.5!(ga.east)$] (s) {switch};
\node[amp,right=of s-out] (g) {};
\node[block, right=of g] (tf) {$\displaystyle%
                                \frac{1}{1+\sum_{i=1}^p a_p(i)z^{-i}}$};                  
 % pins
 \draw[->,dashed] (pin-p.south -| s-s) node[lbl] {$V/NV$} -- (s-s);
 \draw[->,dashed] (pin-p.south -| g)   node[lbl] {$\sigma$} -- (g);
 \draw[double,->,dashed] (pin-p.south -| tf) node[lbl] {$|a_p(i)|$} -- (tf);
% lines
\draw[thick]    (gp) -| (s-in1)
                (ga) -| (s-in2)
                (s-out) -- (g)
                (g) -- (tf);
\draw[thick,->] (tf.east) -- ++(1cm, 0) node[above] {$x(n)$};
    \end{tikzpicture}
\end{document}

我希望上面的代码是不言自明的。

相关内容