I have the following tikzpicture:


\usepackage[utf8]{inputenc}     % Support for french language


\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)$};

That gives the following image:

Autoregressive System

There were, however, remaining operation that I don't know how to do them:

  1. I would like to align vertically the dashed lines having the symbols \sigma and |a_p(i)| vertically with the dashed line with p symbol

  2. I would like to replace the dashed single line having |a_p(i)| with an arrow double line

  3. I'd like to add 4th vertical dashed line starting with the switch symbol (between r1 and a1 coordinate) having the symbol V/NV and aligned vertically with the 3 other ones.

Any comments or suggestions are welcome.


like this?

enter image description here

i change your code significantly ...


\usepackage[utf8]{inputenc}     % Support for french language

node distance = 2cm and 1cm,
            > = {Straight Barb[angle=60:2pt 3]}, 
 block/.style = {rectangle, draw, 
                 minimum height=3em, minimum width=6em,
    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}
      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)$};

i hope that above code is self-explanatory.

| improve this answer | |
  • I have a compile error when I included the tikzpicture inside a figure in my report: Runaway argument: Paragraph ended before \pgfarrowsfourparameters@ was complete. By elimination, I figure out the problem is the following line: node distance = 2cm and 1cm,>={Straight Barb[angle=60:2pt 3]}. I didn't the way how to fix this. Could you help me with this please. Thanks – user48343 Oct 10 '17 at 13:47
  • i test my answer again and it works as expected. do you receive error, if you test my document? which version of tikz package do you have? – Zarko Oct 10 '17 at 17:22
  • In fact, when I compile your code alone, it compiles fine. But when I included the tikzpicture in my report (I included also the usetikzlibrary), I got a the compile error I described above. By the way, I have Tikz v3.0.1a – user48343 Oct 11 '17 at 11:41
  • 1
    than you have somthing in your main document, which overwrite ikz command. so you use a babel? if do, than try to add tikz library babel. many language used in babel overwrite meaning of some characters as ", }, etc. mentioned library in the most case repair this in tikzpicture. – Zarko Oct 11 '17 at 12:03
  • Your were right ! That was my problem. Now it worked ! Thanks a lot ! – user48343 Oct 13 '17 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.