1

I have the following 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}

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.

2

like this?

enter image description here

i change your code significantly ...

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

i hope that above code is self-explanatory.

  • 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.