TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to LaTeX and I am trying to draw a diagram similar to the one in the figure:

enter image description here

This question was answered and the following is a code for similar diagram.


% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,text width=5em, text centered, minimum height=4em]
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,minimum height=2em]
\tikzstyle{line} = [draw, -stealth, thick]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinfor future referenceate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

\begin{tikzpicture}[auto,node distance =3cm,>=latex',
path/.style={->, >=stealth, postaction = decorate},
decoration={markings, mark = at position 1cm with {\arrow[black]{stealth}}

    % Place nodes
    \node [input, name = input]{Input command};
    \node [block, right of = input] (control) {Controller $C(\theta_c)$};
    \node [block, right of = control](plant){Plant $G(\theta^*$)};
    \node [right of = plant] (output){y};
    \node [block, below of = plant][yshift=1.25cm] (O_p_e) {Online Parameter Estimator};
    \node [block, below of = O_p_e] [yshift=1cm](C_c_p) {Calculation of control parameters};
    \draw[draw,->] ([yshift=-1em]input) -- node [above of = input, node distance = 1em]{Input} ([yshift=-1em]control.west);
  \draw [->] (control) -- node {$u$} (plant);
  \draw [->] (O_p_e) -- node {$\theta(t)$}(C_c_p);
  \draw [->] (control) -- (4.5,0) |- node {} (O_p_e);
    \draw [->] (C_c_p) -| node {$\theta_c(t)$} (control);
    \path[line] (plant) -- (output);
    \draw [->] (plant) -- (7.5,0) |- node {} (O_p_e);
    \draw [->] (plant) -- (7.5,0) -- (7.5,1) -| (0.5,1) |- node {} ([yshift = -0.2cm]control.north west);
share|improve this question
Please show some effort. How about a minimal working example (MWE)? – Werner Aug 11 '13 at 4:04
Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing what you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. — It would also helps you to gain the skills needed to do a different diagram on your own by learning step for step. – Qrrbrbirlbel Aug 11 '13 at 5:32
Hi, I apologize for not posting the MWE. I am new to this website and I will keep that inn my mind for the next questions. I did some research on my own and made a control diagram very similar and the following is the code – John Aug 12 '13 at 0:06
Please don't write the answer inside the question itself: it's perfectly valid to answer your own question, but use a proper answer to do so. – Gonzalo Medina Aug 12 '13 at 15:47

Here's one possibility using the tikz-dsp (Digital Signal Processing) library; the library can be downloaded following the provided link from TeXample.net.

I defined two new styles for the adder, to obtain the label position illustrated in the image from the original question:


    % Coordinate offset for the plus
   line cap=rect,
  line join=rect,
  line width=\dspblocklinewidth,
  minimum size=\dspoperatordiameter,
  line cap=rect,
  line join=rect,
  line width=\dspblocklinewidth,
  minimum size=\dspoperatordiameter,
  label=below right:$-$,
  label=above right:$+$


% the nodes
\matrix[row sep=10mm, column sep=10mm] 
  & \node[vdspadder] (g1) {}; 
    & \node[dspsquare] (g2) {$k_{\textrm{pr}}$}; 
    & \node[dspfilter,text width=2cm] (g3) {Yaw Model}; \\
  \node[dspnodeopen,label=above left:$r_{des}$]  (g4) {};
    & & & 
    & \node[dspfilter,text width=2cm,text height=1.5em,text depth=2em] (g5) 
      {Adaptation \\Law}; 
    & \node[vadspadder] (g6) {};  \\
  & \node[vdspadder] (g7) {}; 
    & \node[dspsquare] (g8) {$k_{\textrm{pr}}$}; 
    & \node[dspsquare] (g9) {$K$}; 
    & \node[dspfilter,text width=2cm] (g10) {Yaw Plant}; \\

% the connections
\draw (g4) -- +(-20pt,0);
\draw[dspconn] (g4) -- (g5);

\draw[dspconn] (g4) |- coordinate[pos=0.85] (aux4) (g1);
\draw[dspconn] (g1) -- (g2);
\draw[dspconn] (g2) -- node[above] {$\delta_{\textrm{mod}}$} (g3);
\draw[dspconn] (g3) -| node[dspnodeopen,pos=0.25] (aux1) {} (g6) node[label=right:$r_{\textrm{mod}}$,pos=0.75] {};
\draw[dspconn] (g6) -- node[auto,swap] {$e$} (g5);
\draw[dspconn] (aux1) -- +(0,-30pt) -| (g1);

\draw[dspconn] (g4) |- (g7);
\draw[dspconn] (g7) -- (g8);
\draw[dspconn] (g8) -- (g9);
\draw[dspconn] (g9) -- node[below,pos=0.25] {$\delta$} (g10);
\draw[dspconn] (g10) -| node[dspnodeopen,pos=0.25] (aux2) {} (g6) node[label=right:$r$,pos=0.75] {};

\draw[dspconn] (aux2) |- (g5.-20);
\draw[dspconn] (aux2) |- +(0,-30pt) -| (g7);

\draw (g5.270) |- +(0,-22pt) -| (g9);
\draw[dspconn] (g9.south) -- +(0,-10pt);

% the fitting dashed nodes
\coordinate (aux3) at ([yshift=-20pt]aux1);
\node[draw,inner xsep=10pt,inner ysep=20pt,dashed,fit=(aux4) (aux3),label=above:{Closed-Loop Yaw Model}] {};

\node[draw,inner xsep=20pt,inner ysep=12pt,dashed,fit=(g8) (g9),label=above:{Yaw Rate Controller}] {};


enter image description here

share|improve this answer
You are LaTeX Guru. – MYaseen208 Aug 11 '13 at 5:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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