Tikz 中的框图

Tikz 中的框图

我正在尝试在 Tikz 中实现以下框图。我会发布我的尝试,但它充其量是相当糟糕的在此处输入图片描述

答案1

这是一种可能的解决方案,所有曲线均由pics包含 pgfplots 定义,这些曲线来自这里,我早期的努力。 在此处输入图片描述

代码

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

答案2

杰西的回答的附注显示了使用图片创建图表的另一种方法:

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

在此处输入图片描述

答案3

这可能是您的起点:

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

相关内容