I'm trying to implement the following block diagram in Tikz.. I would post my attempt, but its fairly dismal at best.
.
Asked
Active
Viewed 1,157 times
3
JS60
- 786
-
1As you have asked questions before you probably know that you have better chances of getting a response if you provide a full minimal working example (MWE), both in order to demonstrate what you are trying to do and to help others help you. Asking people to draw diagrams for you when you don't appear to have tried anything is generally frowned upon... – Oct 13 '14 at 05:53
3 Answers
6
This is one possible solution, all curves are defined by pics which contains pgfplots,
which are from HERE, my earlier efforts.

Code
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning,arrows,calc}
\tikzset{block/.style = {rectangle, draw, fill=white,
text width=4em, text centered, rounded corners, minimum height=6em},
line/.style = {draw, -latex'},
io/.style={draw, circle,inner sep=0pt,minimum size=4pt}
}
%
\tikzset{mysine/.pic={
\begin{axis}[ axis x line=center, ticks=none,
axis y line=left, enlargelimits=upper]
% draw sine functions
\addplot [dashed,thin,domain=-pi:6*pi,smooth]{-2*sin(deg(0.5*x))};
\end{axis}
},
reti/.pic={
\begin{axis}[ axis x line=center, ymin=0,ticks=none,
axis y line=left, enlargelimits=upper]
% draw sine functions
\addplot [dashed,thin,domain=-pi:6*pi,smooth]{-2*sin(deg(0.5*x))};
\addplot [dashed,thin,domain=-pi:6*pi,smooth]{ 2*sin(deg(0.5*x))};
\end{axis}
},
filted/.pic={
\def\arch{1.7*pi/3}
\begin{axis}[xmin=-3,xmax=11,
ymin=0,ticks=none ,
axis x line=center,
axis y line=left, enlargelimits=upper]
\foreach \i/\j/\k in {-1/0/1,1/2/3,3/4/5,5/6/7}{
\addplot [thick,domain=\i*pi:{\j*pi+\arch}, ] {2*e^(-0.05*(x-\i*pi)}; % exponentially decay curves, not a line
\addplot [thick,domain={\j*pi+\arch}:\k*pi, smooth]{ 2*sin(deg(0.5*x))};
\addplot [thick,domain={\j*pi+\arch}:\k*pi, smooth]{-2*sin(deg(0.5*x))};
}
\end{axis}
},
dc/.pic={
%\draw (0,2) -- (4,2);
\begin{axis}[xmin=0,xmax=11,ymin=0,
axis x line=center, ticks=none,
axis y line=left, enlargelimits=upper]
\addplot [thick,domain=0:11] {2}; % a line
\end{axis}
},
}
\begin{document}
\begin{tikzpicture}[]
\node (in1) [above=1cm,io, label={[yshift=-0.5cm]left:Input}]{};
\node (in2) [below=1cm of in1, io]{};
\node (out1) [right= 13cm of in1]{};
\node (out2) [right= 13cm of in2]{};
\draw (in1)--node[pos=0.8,above=2pt]{$I_{out}$}(out1);
\draw (in2)--(out2);
\path (in1)--node[pos=0.5](a){}(in2)
node[block,right=1cm of a](t){Trans-\\former}
node[block,right=1cm of t](r){Rectifier}
node[block,right=1cm of r](f){Filter}
node[block,right=1cm of f](re){Regulator}
node[block,right=1cm of re](l){Load}
;
\draw[->] (11,1.2)--+(0.5,0);
\node[above right=0.2cm and 1cm] at (re){$+$};
\node[right=1cm] at (re){$V_{out}$};
\node[below right=0.2cm and 1cm] at (re){$-$};
\pic at (2.5,2) [scale=0.2]{mysine};
\pic at (5.5,-2) [scale=0.2]{reti};
\pic at (8,2) [scale=0.2]{filted};
\pic at (10.5,-2) [scale=0.2]{dc};
\end{tikzpicture}
\end{document}
3
Just a side note to Jesse's answer showing another way of using pics to create the graphs:
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{arrows.meta,calc}
\tikzset{function/.pic={
\tikzset{x=1.5cm/720, y=1cm/2}
\draw [->] (0,0) -- (850,0);
\draw [->] (0,0) -- (0,1.5);
\draw plot [domain=0:720, samples=180, smooth] (\x, {#1});
}
}
\begin{document}
\begin{tikzpicture}[>=Stealth]
\path (0,0) pic {function={sin(\x)}};
\path (0,1) pic {function={abs(sin(\x))}};
\path (0,2) pic {function={1-exp(mod(\x,180)/180)/6}};
\path (0,3) pic {function={1/sqrt(2)}};
\end{tikzpicture}
\end{document}

Mark Wibrow
- 70,437
2
This might be a starting point for you:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\tikzset{largeBlock/.style={rectangle,draw,minimum width=1cm,minimum height=1.5cm,text width=1cm,text centered,fill=white}}
\tikzset{thinBlock/.style={rectangle,draw,minimum width=.75cm,minimum height=1.5cm,text width=.75cm,text centered,fill=white}}
\begin{tikzpicture}[every node/.style={font=\tiny}]
\draw[o-] (0,.4) -- ++(9,0);
\draw[o-] (0,-.4) -- ++(9,0);
\node[largeBlock] at (1,0) {Trans-\\former};
\node[largeBlock] at (3,0) {Rectifier};
\node[thinBlock] at (5,0) {Filter};
\node[largeBlock] at (7,0) {Regulator};
\node[thinBlock] at (9,0) {Load};
\node at (8.125,.75) {$I_{out}$};
\node at (8.125,.55) {$\rightarrow$};
\node at (8.125,.25) {$+$};
\node at (8.125,0) {$V_{out}$};
\node at (8.125,-.25) {$-$};
\end{tikzpicture}
\end{document}
-
Nice, as a first beginning, but you could merge the repeating code with 2 to 3
\foreachloops. – Dan H. Oct 13 '14 at 07:12 -
@DanH. The purpose of my answer was to provide just a starting point. Sometimes the simpler the better. Plus I guess the
arrowslibrary is not mandatory... – s__C Oct 13 '14 at 07:28 -
Yeah ok, I'm with you in your first point.
Arrowslibrary is needed by\draw[o-]. – Dan H. Oct 13 '14 at 07:48 -
Ah right. I'm always using latexit so I'm sometimes lost with the libraries. – s__C Oct 13 '14 at 07:58