TikZ 帮助:根据 e/m 比率实验重建图表——亥姆霍兹线圈和电路

TikZ 帮助:根据 e/m 比率实验重建图表——亥姆霍兹线圈和电路

我需要在 TikZ 中重新创建两幅图像。第一幅是实验中的亥姆霍兹线圈及其间距: 在此处输入图片描述

第二个是线圈的接线:

在此处输入图片描述

我对第一张图片的(非常)最小工作示例如下:

\begin{figure}
\centering
\begin{tikzpicture}
\draw(1, 1) circle (170 pt);

\draw(7, 7) -- (9, 7);

\draw (8, 1) node {\Huge $d$};

\path[->,>=angle 90, thick](8, 2) edge (8,6.5);

\path[->,>=angle 90, thick](8, 0) edge (8, -4.5);

\draw(7, -5) -- (9, -5);

\draw[very thick] (-4.5, 7) rectangle (-2.5, -5);

\draw[very thick] (4.5, 7) rectangle (6.5, -5);

\draw[loosely dashed] (-3.5, 9) -- (-3.5, -7);

\draw[loosely dashed] (5.5, 9) -- (5.5, -7);

\draw (1, 1) node {\Huge $\frac{d}{2}$};

\path[->,>=angle 90, thick](0, 1) edge (-3.5, 1);

\path[->,>=angle 90, thick](2, 1) edge (5.5, 1);

\path[->,>=angle 90, very thick] (0, 3) edge (2, 3);

\end{tikzpicture}
\caption{Helmholtz Coil Geometry}
\label{Helmholtz}
\end{figure}

在此处输入图片描述

对于第二张图片,它更加简约,我有

    \begin{figure}
\centering
\begin{tikzpicture}
\draw[thick] (0, 5) rectangle (7, 0);

\draw[thick] (-6, 7) rectangle (-2, -0.5);

\draw[thick]  (1, 4.2) circle (5 pt);

\draw[thick]  (3.5, 3.9) circle (5 pt);

\draw[thick]  (6, 4.2) circle (5 pt);

\draw[thick]  (1, 0.8) circle (5 pt);

\draw[thick]  (3.5, 1.1) circle (5 pt);

\draw[thick]  (6, 0.8) circle (5 pt);

\end{tikzpicture}
\caption{Wiring Diagram for Helmholtz Coils}
\label{Circuit}
\end{figure}

在此处输入图片描述

答案1

这是一个伪 3D 变体。但请注意,库node中的3d行为很奇怪(只有单个节点有效,仍然需要三个坐标...)

代码

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{3d,arrows}

% fix the implementation of "canvas is xy plane at z"
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
  \def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
  \def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
  \def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
  \tikz@canvas@is@plane
}
\makeatother

% define styles for the three coordinate planes
\tikzset{xyp/.style={canvas is xy plane at z=#1}}
\tikzset{xzp/.style={canvas is xz plane at y=#1}}
\tikzset{yzp/.style={canvas is yz plane at x=#1}}

\begin{document}

\begin{tikzpicture}[x={(-30:1cm)},y={(190:1cm)},z={(90:1cm)}]% set unit vectors

    % "back" coil and optical axis
    \filldraw[yzp=-1.1,gray!80,draw=black,even odd rule](0,0) circle (1.8) (0,0) circle (2.2);
    \draw[densely dashdotted,yzp=-1](0,-2.9) -- (0,-2.2)  (0,-1.8) -- (0,1.8)  (0,2.2) -- (0,2.9);
    \filldraw[yzp=-0.9,gray,draw=black,even odd rule](0,0) circle (1.8) (0,0) circle (2.2);

    % experimental zone and text
    \filldraw[xzp=0,red,opacity=0.5,draw=red!50!black](0,0) circle (2);
    \draw[xzp=0,shorten <=0.5mm,shorten >=-1mm] (0,2) -- (0.4,3.5);
    \node[xzp=0,above,font=\footnotesize] at (0.4,0,3.5) {experimental zone};

    % magnetic field arrow and text; note that "latex" is a special arrow
    \draw[xzp=0,-latex] (-0.4,-1.4) -- (0.4,-1.4);
    \node[below,xzp=0] at (0,0,-1.4) {$\mathbf{B}$};
    \node[above,xzp=0,font=\footnotesize] at (0,0,-1.4) {magnetic field};

    % half diameter and text
    \draw[xzp=0,latex-latex] (-1,1) -- (1,1);
    \node[xzp=0,below] at (0.75,0,1) {$\frac{d}{2}$};

    % "front" coil and optical axis
    \filldraw[yzp=0.9,gray!80,draw=black,even odd rule](0,0) circle (1.8) (0,0) circle (2.2);
    \draw[densely dashdotted,yzp=1](0,-2.9) -- (0,-2.2)  (0,-1.8) -- (0,1.8)  (0,2.2) -- (0,2.9);
    \filldraw[yzp=1.1,gray,draw=black,even odd rule](0,0) circle (1.8) (0,0) circle (2.2);

    % diameter and text
    \draw[xzp=0] (1.1,2) -- (2,2) (1.1,-2) -- (2,-2);
    \draw[xzp=0,latex-latex] (1.8,2) -- (1.8,-2);
    \node[xzp=0,right] at (1.8,0,1.6) {$d$};
\end{tikzpicture}

\end{document}

输出

在此处输入图片描述


编辑1:对于第二张图片,您可以使用nodes(coordinates 表示零宽度节点),这将使连接更容易。对于线圈,您可以查看库circuits

代码

\begin{tikzpicture}
    \draw[thick] (0, 5) rectangle (7, 0);

    \draw[thick] (-6, 7) rectangle (-2, -0.5);

    \draw[thick] (-5.5, 0) rectangle (-3, 1.5);
    \node[right] at (-3,0.75) {A};
    \foreach \x in {10,20,...,170} \draw (-4.25,0) ++ (\x:1) -- ++(\x:0.2);
    \draw[very thick,-latex] (-4.25,0) -- ++ (85:0.95);

    \node[circle,draw,inner sep=1.5mm] (tl) at (1, 4.2) {};
    \node[circle,draw,inner sep=1.5mm] (tm) at (3.5, 3.9) {};
    \node[circle,draw,inner sep=1.5mm] (tr) at (6, 4.2) {};
    \node[circle,draw,inner sep=1.5mm] (bl) at (1, 0.8) {};
    \node[circle,draw,inner sep=1.5mm] (bm) at (3.5, 1.1) {};
    \node[circle,draw,inner sep=1.5mm] (br) at (6, 0.8) {};

    \node[inner sep=0.5mm,circle,draw,label=180:+] (plus) at (-2.5,5) {};
    \draw (-2.5,5) circle (0.15);
    \draw[-latex] (plus) -| ++ (1,3) -| node[pos=0.25,circle,fill=white,draw] {A} (tm);

    \draw[latex-latex] (tl) -- (1,3.5) -- (6,1.5) -- (br);
    \draw[latex-latex] (tr) -- (6,3.5) -- (1,1.5) -- (bl);
\end{tikzpicture}

在此处输入图片描述

相关内容