使用 TikZ 进行电磁波传播

使用 TikZ 进行电磁波传播

如果可能的话,我正在寻找使用 TikZ 绘制下图的代码:

我只需要中间的图表,即不需要同时包含文本和/或方程式。只需将图与轴放在一起就足够了。

根据评论的建议,我在网上找到了这段我复制的代码,但不知何故它无法工作:我从中窃取的源代码是 PDF,当我将其粘贴到 TeX 编辑器中时,发现有很多不必要的空白和其他东西。我怀疑这就是它不起作用的原因。

% Codice di Spike
\documentclass[a4paper ,11 pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[y ={(0.866 cm,-0.5 cm)} , x ={(-0.866 cm ,-0.5 cm )},z ={(0 cm ,1 cm )}]
\coordinate(O) at (0 , 0 , 0);
\draw [-latex ](O) -- +(2 , 0 , 0) node [ left ]{$ x $};
\draw [-latex ](O) -- +(0 , 7 , 0) node [ right ]{$ y $};
\draw [-latex ](O) -- +(0 , 0 , 2) node [ above ]{$ z $};
 % onde e vettori che indicano l? intensita ? dei campi
\draw [thick,color=teal,variable=\x,samples at ={0 ,0.1 ,... ,6.3}] 
    plot ({ - sin (2* \x r )},\x ,0) node [ anchor = north ]{$ \vec { E }$};
\foreach \x in {0.25 , 0.5 ,... ,6}
    \draw [ color =teal , - latex ] (0 , \x ,0) -- ({ - sin (2* \x r )} , \x ,0);
    \draw [thick , color = purple , variable =\x , samples at ={0 ,0.1 ,... ,6.3} ]
    plot (0 , \x ,{ - sin (2* \x r )}) node [ anchor = west ]{$ \vec { H }$};
\foreach \x in {0.25 , 0.5 ,... ,6}
     \draw [color = purple , - latex] (0 , \x ,0) -- (0 , \x ,{ - sin (2* \x r )});
    % lambda - " lunghezza d? onda " dell ? onda
    \draw [help lines] (0 ,2.35 ,1.4) -- (0 ,2.35 ,1.6);
    \draw [help lines] (0 ,5.49 ,1.4) -- (0 ,5.49 ,1.6);
    \draw [help lines] (0 ,2.35 ,1.5) -- (0 ,5.49 ,1.5)
    node [pos =0.5 , fill =white , text = black ]{$ \lambda $};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

使用 TikZ

\documentclass{article}
\usepackage{tikz,bm}
\usepackage[raggedrightboxes]{ragged2e}
\begin{document}
\begin{center}
  \begin{tikzpicture}[x={(-10:1cm)},y={(90:1cm)},z={(210:1cm)}]
    % Axes
    \draw (-1,0,0) node[above] {$x$} -- (5,0,0);
    \draw (0,0,0) -- (0,2,0) node[above] {$y$};
    \draw (0,0,0) -- (0,0,2) node[left] {$z$};
    % Propagation
    \draw[->,ultra thick] (5,0,0) -- node[above] {$c$} (6,0,0);
    % Waves
    \draw[thick] plot[domain=0:4.5,samples=200] (\x,{cos(deg(pi*\x))},0);
    \draw[gray,thick] plot[domain=0:4.5,samples=200] (\x,0,{cos(deg(pi*\x))});
    % Arrows
    \foreach \x in {0.1,0.3,...,4.4} {
      \draw[->,help lines] (\x,0,0) -- (\x,{cos(deg(pi*\x))},0);
      \draw[->,help lines] (\x,0,0) -- (\x,0,{cos(deg(pi*\x))});
    }
    % Labels
    \node[above right] at (0,1,0) {$\bm{E}$};
    \node[below] at (0,0,1) {$\bm{B}$};
  \end{tikzpicture}

  \begin{minipage}{.5\linewidth}
    \[
      c = \frac{E}{B}
    \]
    \begin{tabular}{r@{${}={}$}p{.8\linewidth}}
      $E$ & electric field amplitude \\
      $B$ & magnetic field amplitude (instantaneous values) \\
      $c$ & speed of light ($3\times10^8\mathrm{m/s}$) \\
    \end{tabular}
  \end{minipage}%
  \begin{minipage}{.5\linewidth}
    \[
      c = \frac{1}{\sqrt{\mu_0 \varepsilon_0}}
    \]
    \begin{tabular}{r@{${}={}$}p{.8\linewidth}}
      $\mu_0$ & magnetic permeability in a vacuum, $\mu_0 = 1.3\times10^{-6}\,\mathrm{N/A^2}$ \\
      $\varepsilon_0$ & electric permeability in a vacuum, $\varepsilon_0 = 8.9\times10^{-12}\,\mathrm{C^2/N m^2}$ \\
    \end{tabular}
  \end{minipage}
\end{center}
\end{document}

在此处输入图片描述

相关内容