绘制电路图

绘制电路图

我正在尝试绘制此图,但我陷入了天线文本位置。此外,我对半圆形天线的绘制不满意。我还缺少圆圈内的弯曲箭头。有人能帮忙修复这个问题吗?这张图是否可以改进和优化?

原始图像 在此处输入图片描述

我的代码

\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
   \begin{tikzpicture} 
   %\draw [help lines,step=1cm] (0,0) grid (12,18) ;
   \draw [ultra thick, yshift=15.5cm, domain=-70:70,line cap=round] plot(.8*\x:1) node[below,fill=none] (ant) {Antenna} ;
   \draw[arrows={latex-latex},thick] (1,15.5) -- (2.5,15.5) node (a1) {}; 
   \node[draw,thick,circle,inner sep=0pt,minimum size=1cm] at (3,15.5) (A1) {};

\foreach \pos/\txt in {5/Transmitter,8/Waveform Generator} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,15) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\draw[draw=black,thick,text width=2.5cm, align=center] (2.,13) rectangle ++(2,1) node[pos=.5] {\scriptsize Low Noise RF Amp };

\foreach \pos/\txt in {2/Mixer,5/Local \\ Oscilator,8/Display} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,11) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\foreach \pos/\txt in {2/IF Amplifier,5/Signal \\ Processing,8/Data \\ Processor} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,9) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\foreach \lpos in {15,13,11}{
    \draw[->,arrows={-latex},thick] (3,\lpos) -- (3,\lpos-1);
};

\draw[<-,arrows={-latex},thick] (5,15.5) -- (3.5,15.5);
\draw[<-,arrows={-latex},thick] (6,12) -- (6,15);
\draw[<-,arrows={-latex},thick] (8,15.5) -- (7,15.5);
\draw[<-,arrows={-latex},thick] (4,11.5) -- (5,11.5);
\draw[<-,arrows={-latex},thick] (4,09.5) -- (5,09.5);
\draw[<-,arrows={-latex},thick] (7,09.5) -- (8,09.5);
\draw[<-,arrows={-latex},thick] (9,10) -- (9,11);               
\draw[<-,arrows={-latex},thick] (7.5,9.5) -- (7.5,11.5) -- (8,11.5);                
\end{tikzpicture}
\end{document}

我对上述代码的理解如下

在此处输入图片描述

答案1

这是一个使用样式和相对定位的选项

\documentclass[tikz, border = 5pt]{standalone}

\usetikzlibrary{arrows, positioning, decorations.markings, calc}
\begin{document}

\begin{tikzpicture}[
    node distance = 1cm and 2cm,
  ]

  \tikzstyle{block} = [
    draw,
    minimum width = 2cm,
    minimum height = 1cm,
    inner sep = 2pt,
    outer sep = 0pt,
    align = center,
    thick
    ]

  \tikzstyle{duplexer} = [
    draw,
    circle,
    minimum width = 1cm,
    inner sep = 2pt,
    outer sep = 0pt,
    thick
    ]

  \tikzstyle{line} = [
    -latex',
    thick,
    ]

  % nodes
  \node[duplexer] (duplexer) at (0, 0) [label=above:Duplexer]{};
  \node[block, right=2.5cm of duplexer] (transmiter) {Transmiter};
  \node[block, right=of transmiter] (wf generator) {Waveform\\Generator};
  \node[block, below=of duplexer] (low noise amp) {Low-Noise\\RF\\Amplifier};
  \node[block, below=of low noise amp] (mixer) {Mixer};
  \node[block, right=of mixer] (local oscillator) {Local\\Oscilator};
  \node[block, right=of local oscillator] (display) {Display};
  \node[block, below=of mixer] (ip amplifier) {IP Amplifier};
  \node[block, right=of ip amplifier] (signal processor) {Signal\\Processor};
  \node[block, right=of signal processor] (data processor) {Data\\Processor};

  % connections
  \draw[line] (transmiter) -- (duplexer);
  \draw[line] (wf generator) -- (transmiter);
  \draw[line] (duplexer) -- (low noise amp);
  \draw[line] (low noise amp) -- (mixer);
  \draw[line] (mixer) -- (local oscillator);
  \draw[line] (local oscillator) -- (transmiter);
  \draw[line] (mixer) -- (ip amplifier);
  \draw[line] (ip amplifier) -- (signal processor);
  \draw[line] (signal processor) -- (data processor) coordinate[pos = 0.5] (A);
  \draw[line] (data processor) -- (display);
  \draw[line] (A) |- (display);

  % circle
  \draw[-latex'] ([yshift = 0.3cm]duplexer) arc (90 : 370 : 0.3);

  % antena
  \coordinate (B) at ([xshift = -2cm]duplexer);
  \draw[ultra thick, rotate around = {90:(B)}] ([xshift = -1cm, yshift = 0.3cm]B)
  parabola bend (B) ([xshift = 1cm, yshift = 0.3cm]B) node[above]{Antenna};
  \draw[line] (duplexer) -- (B);
  \draw[line] (B) -- (duplexer);


\end{tikzpicture}

\end{document}

在此处输入图片描述

并进行了一些修改

\documentclass[tikz, border = 5pt]{standalone}

\usetikzlibrary{arrows, positioning, decorations.markings, calc}

\def\nframes{20}
\def\frame{0}

\begin{document}

\foreach \frame in {0,...,\nframes}
{
\pgfmathsetmacro{\time}{\frame / \nframes}


\begin{tikzpicture}[
    node distance = 1cm and 2cm,
  ]

  \tikzstyle{block} = [
    draw,
    minimum width = 2cm,
    minimum height = 1cm,
    inner sep = 2pt,
    outer sep = 0pt,
    align = center,
    thick
    ]

  \tikzstyle{duplexer} = [
    draw,
    circle,
    minimum width = 1cm,
    inner sep = 2pt,
    outer sep = 0pt,
    thick
    ]

  \tikzstyle{line} = [
    -latex',
    thick,
    postaction={
      decorate,
      decoration={
        markings,
        mark = at position \time with {\fill[orange, opacity = 0.3] circle (0.1);}
      }
    }
    ]

  % nodes
  \node[duplexer] (duplexer) at (0, 0) [label=above:Duplexer]{};
  \node[block, right=2.5cm of duplexer] (transmiter) {Transmiter};
  \node[block, right=of transmiter] (wf generator) {Waveform\\Generator};
  \node[block, below=of duplexer] (low noise amp) {Low-Noise\\RF\\Amplifier};
  \node[block, below=of low noise amp] (mixer) {Mixer};
  \node[block, right=of mixer] (local oscillator) {Local\\Oscilator};
  \node[block, right=of local oscillator] (display) {Display};
  \node[block, below=of mixer] (ip amplifier) {IP Amplifier};
  \node[block, right=of ip amplifier] (signal processor) {Signal\\Processor};
  \node[block, right=of signal processor] (data processor) {Data\\Processor};

  % connections
  \draw[line] (transmiter) -- (duplexer);
  \draw[line] (wf generator) -- (transmiter);
  \draw[line] (duplexer) -- (low noise amp);
  \draw[line] (low noise amp) -- (mixer);
  \draw[line] (mixer) -- (local oscillator);
  \draw[line] (local oscillator) -- (transmiter);
  \draw[line] (mixer) -- (ip amplifier);
  \draw[line] (ip amplifier) -- (signal processor);
  \draw[line] (signal processor) -- (data processor) coordinate[pos = 0.5] (A);
  \draw[line] (data processor) -- (display);
  \draw[line] (A) |- (display);

  % circle
  \draw[-latex'] ([yshift = 0.3cm]duplexer) arc (90 : 370 : 0.3);

  % antena
  \coordinate (B) at ([xshift = -2cm]duplexer);
  \draw[ultra thick, rotate around = {90:(B)}] ([xshift = -1cm, yshift = 0.3cm]B)
  parabola bend (B) ([xshift = 1cm, yshift = 0.3cm]B) node[above]{Antenna};
  \draw[line] (duplexer) -- (B);
  \draw[line] (B) -- (duplexer);

  % signal
  \coordinate (C) at ($(B) + (-0.5 * \time, 0)$);
  \draw[red, opacity = 0.5, thick, rotate around = {90:(C)}] ([xshift = -1cm, yshift = 0.3cm]C)
  parabola bend (C) ([xshift = 1cm, yshift = 0.3cm]C);


  \coordinate (D) at ($(B) + ({-0.5 * (2 - \time)}, 0)$);
  \draw[blue, opacity = 0.5, thick, rotate around = {-90:(D)}] ([xshift = -1cm, yshift = 0.3cm]D)
  parabola bend (D) ([xshift = 1cm, yshift = 0.3cm]D);

\end{tikzpicture}
}
\end{document}

在此处输入图片描述

答案2

此解决方案使用matrix节点和anchors作为连接的参考。箭头使用arrows.metabend库绘制,从而在双工器中产生更好的内部箭头。

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{arrows.meta, matrix, bending}
\usepackage{lmodern}

\begin{document}
   \begin{tikzpicture}[
        font=\sffamily\scriptsize,
        box/.style={draw, thick, text width=2cm, align=center, minimum width=2cm, minimum height=1cm},
        ball/.style={draw, thick, circle, text width=0pt, minimum size=1cm},
        >={Latex[bend]}]

    \matrix (A) [matrix of nodes, nodes={box, anchor=center}, column sep=.8cm, row sep=.5cm,
        row 1 column 1/.style={nodes={ball}},
        ]{
        {} & Transmitter & {Waveform\\ Generator}\\
        {Low Noise\\ RF Amp} &  & \\
        Mixer & {Local\\ oscilator} & Display\\
        IF Amplifier & {Signal\\ Processing} & {Data\\ Processor}\\
    };

    \draw[<-, thick] (A-1-1)--(A-1-2);
    \draw[<-, thick] (A-1-2)--(A-1-3);
    \draw[->, thick] (A-1-1)--(A-2-1);
    \draw[->, thick] (A-2-1)--(A-3-1);
    \draw[->, thick] (A-3-1)--(A-3-2);
    \draw[->, thick] (A-3-2)--(A-1-2);
    \draw[->, thick] (A-3-1)--(A-4-1);
    \draw[->, thick] (A-4-1)--(A-4-2);
    \draw[->, thick] (A-4-2)--(A-4-3) coordinate[midway] (aux);
    \draw[->, thick] (aux)|-(A-3-3);
    \draw[<->, thick] (A-1-1.west)--++(180:1cm) coordinate (aux2);
    \draw[ultra thick, line cap=round] ([xshift=-1cm]aux2)+(-50:1cm) node[below]{Antenna} arc(-50:50:1cm);
    \node[above] at (A-1-1.north) {Duplexer};
    \draw[->] (A-1-1.center)+(90:.3cm) arc(90:360:3mm);

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

我只添加了一个新节点,\node at (x,y) {Antenna}并使用 fittet texsize\footnotesize

对于带箭头的弧线,你可以使用\draw[->,>=stealth',thin] (3,15.8) arc[radius=.3, start angle=90, end angle=360];

图片: 在此处输入图片描述

以下是新代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows}

\begin{document}
   \begin{tikzpicture} 
   %\draw [help lines,step=1cm] (0,0) grid (12,18) ;
   \draw [ultra thick, yshift=15.5cm, domain=-70:70,line cap=round] plot(.8*\x:1);
   \node at (.6,14.4) {\footnotesize Antenna};
   \draw[arrows={latex-latex},thick] (1,15.5) -- (2.5,15.5) node (a1) {}; 

   \node[draw,thick,circle,inner sep=0pt,minimum size=1cm] at (3,15.5) (A1) {};
   \node at (3,16.2) {\footnotesize Duplexer};
   \draw[->,>=stealth',thin] (3,15.8) arc[radius=.3, start angle=90, end angle=360];

\foreach \pos/\txt in {5/Transmitter,8/Waveform Generator} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,15) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\draw[draw=black,thick,text width=2.5cm, align=center] (2.,13) rectangle ++(2,1) node[pos=.5] {\scriptsize Low Noise RF Amp };

\foreach \pos/\txt in {2/Mixer,5/Local \\ Oscilator,8/Display} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,11) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\foreach \pos/\txt in {2/IF Amplifier,5/Signal \\ Processing,8/Data \\ Processor} {{\draw[draw=black,thick,text width=2.5cm, align=center] (\pos,9) rectangle ++(2,1) node[pos=.5] {\scriptsize \txt };};}

\foreach \lpos in {15,13,11}{
    \draw[->,arrows={-latex},thick] (3,\lpos) -- (3,\lpos-1);
};

\draw[<-,arrows={-latex},thick] (5,15.5) -- (3.5,15.5);
\draw[<-,arrows={-latex},thick] (6,12) -- (6,15);
\draw[<-,arrows={-latex},thick] (8,15.5) -- (7,15.5);
\draw[<-,arrows={-latex},thick] (4,11.5) -- (5,11.5);
\draw[<-,arrows={-latex},thick] (4,09.5) -- (5,09.5);
\draw[<-,arrows={-latex},thick] (7,09.5) -- (8,09.5);
\draw[<-,arrows={-latex},thick] (9,10) -- (9,11);               
\draw[<-,arrows={-latex},thick] (7.5,9.5) -- (7.5,11.5) -- (8,11.5);                
\end{tikzpicture}
\end{document}

相关内容