1

I'm trying to draw a simple block diagram that looks like this:

source-filter-diagram

schemabloc seems to be the package to use, but then again, it doesn't have the switch symbol that I need. circuitikz doesn't seem to be working either.

How would I draw this diagram using tikz or any other method?

1
  • Related to this? – user10274 Apr 12 '14 at 13:31
2

This is a possible solution where a couple of styles is defined for ease of tikz drawing.

enter image description here

Code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{decorations.markings,shapes,arrows}
\begin{document}
\begin{tikzpicture}[->,auto,node distance=3cm,scale=1]
\tikzset{point/.style={coordinate},
block/.style ={draw, thick, rectangle, minimum height=4em, minimum width=6em},
line/.style ={draw, very thick,-},
}
\node[block] (a) []{Noice};
\node[block] (b) [below =2cm of a]{F0};
\node[block,yshift=1.6cm] (r) [right = 2 cm  of b]{VT};
\draw[line] (r.west) -- ++(-0.5cm,0) coordinate(r1){}; 
\draw[line] (b.east) -- ++(1cm,0) -- ++(0,1cm) coordinate(b1){};
\draw[line] (a.east) -- ++(1cm,0) -- ++(0,-1cm)coordinate(a1){};
\draw[line,rounded corners=2pt]  (b1)  -- (r1);
\draw[very thick] ($(b1)+(-5pt,0)$) to [bend left ]($(a1)+(-5pt,0)$);
\draw[very thick,->=stealth]  (r.east) -- ++(1cm,0) node[right](){Out};
\end{tikzpicture}
\end{document}
2

Here's a simple version in plain Metapost.

enter image description here

The units are PostScript points: 72 = 1in, 28.35=1cm.

prologues := 3;
outputtemplate := "%j%c.eps";
input boxes;
beginfig(1);
% define the boxes
boxit.n("Noise");
boxit.f("F0");
boxit.v("VT");
boxit.o("Out");
% place the centres of all the boxes, v.c = origin by implication
v.c + 20 up   + 75 left = n.c;
v.c + 20 down + 75 left = f.c;
v.c + 50 right          = o.c;
% define three points for the switch terminals
z1 = v.w + 10 left;
z2 = v.w + 20 left + 10 up;
z3 = v.w + 20 left + 10 down;
% make the boxes with borders all the same size
n.e-n.w = f.e-f.w = v.e-v.w = 34 right;
n.n-n.s = f.n-f.s = v.n-v.s = 21 up;
% draw the boxes, draw "Out" with no boundary
drawboxed(v,f,n); drawunboxed(o);
% draw the connections
draw n.e -- (x2,ypart n.e) -- z2;
draw f.e -- (x3,ypart f.e) -- z3 -- z1 -- v.w;
drawarrow v.e -- o.w;
% draw an arc to show the movement of the switch
ahlength := 2; % with a smaller arrowhead
drawarrow z3 { (z1-z3) rotated 90 } .. z2 { (z1-z2) rotated 90 } 
          cutbefore fullcircle scaled 4 shifted z3
          cutafter  fullcircle scaled 4 shifted z2
          withcolor .5 white;
% put dots on the terminals
forsuffixes $=1,2,3: filldraw fullcircle scaled 2 shifted z$; endfor
endfig;
end.
2
  • First time seeing Metapost. Seems quite 'overkill'/complex though, no? – James Union Apr 13 '14 at 12:24
  • @JamesUnion "overkill" is a matter of taste of course, but Metapost grows on you as a language; and there's not really much more complexity in the language than I've shown above. If you want something simple, buy a copy of PowerPoint or Omnigraffle (or similar) and push boxes around with your mouse, export the results as PDF and use \includegraphics to get the picture into LaTeX. – Thruston Apr 13 '14 at 16:07

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.