LaTeXのTikZ 〜波の干渉
波の干渉のための図を残しておく。
1. 必要なパッケージ
\usepackage{tikz}
\usepackage[dvipsnames]{xcolor}
色を変えるために xcolor パッケージを使う。また、NavyBlue や Maroon などの色を使っているので、 [dvipsnames] オプションを追加している。
2. 同位相の波源による波面
2-1. TikZ のコード
%波の干渉 作図用
\begin{tikzpicture}[baseline=0]
\coordinate (A) at (-3.2,0); %x軸最小
\coordinate (B) at (3.2,0); %x軸最小
\node[left,scale = 1.5 ] at (A) {$S_1$};
\node[right,scale = 1.5 ] at (B) {$S_2$};
\begin{scope} \clip (-6,-3.6) rectangle (6,3.6);
\foreach \n in{0,1,...,10}
{
\draw[NavyBlue,semithick] (A) circle ( 1.2*\n) ;
\draw[dashed,NavyBlue,semithick] (A) circle ( 1.2*\n + 0.6) ;
\draw[Maroon,semithick] (B) circle ( 1.2 * \n) ;
\draw[dashed,Maroon,semithick] (B) circle ( 1.2 * \n + 0.6) ;
};
\fill (A) circle ( 0.08) ;
\fill (B) circle ( 0.08) ;
\end{scope}
\end{tikzpicture}
2-2. 出力の様子
実線は山を、破線は谷を示すつもりで記載した。
3. 同位相の波源による干渉が描く双曲線
3-1. TikZ のコード
% 双曲線を描画するマクロ
\newcommand{\drawHyperbola}[4]{
\draw[very thick,samples=200,domain=#1:#2,gray!60,#4] plot(\x,{#3*sqrt(pow(\x,2)/pow(#1-0.00001,2) - 1) });
\draw[very thick,samples=200,domain=#1:#2,gray!60,#4] plot(\x,{-#3*sqrt(pow(\x,2)/pow(#1-0.00001,2) - 1) });
\draw[very thick,samples=200,domain=-#1:-#2,gray!60,#4] plot(\x,{#3*sqrt(pow(\x,2)/pow(#1-0.00001,2) - 1) });
\draw[very thick,samples=200,domain=-#1:-#2,gray!60,#4] plot(\x,{-#3*sqrt(pow(\x,2)/pow(#1-0.00001,2) - 1) });
}
\begin{tikzpicture}[baseline=0, scale=1.0]
\coordinate (A) at (-3.2,0); % 波源 S1 の位置
\coordinate (B) at (3.2,0); % 波源 S2 の位置
\node[left,scale=1.5] at (A) {$S_1$};
\node[right,scale=1.5] at (B) {$S_2$};
\begin{scope}
\clip (-7,-4) rectangle (7,4);
\foreach \n in {0,1,...,10} {
\draw[NavyBlue,semithick] (A) circle (1.2*\n);
\draw[dashed,NavyBlue,semithick] (A) circle (1.2*\n + 0.6);
\draw[Maroon,semithick] (B) circle (1.2*\n);
\draw[dashed,Maroon,semithick] (B) circle (1.2*\n + 0.6);
}
\fill (A) circle (0.1); % 波源のサイズを少し大きく
\fill (B) circle (0.1);
%-------双曲線-------%
\draw[very thick,gray!60] (0,10) -- ( 0,-10);
\drawHyperbola{0.3}{6}{3.2}{dashed};
\draw[very thick,gray!60,dashed] (0.3, 0.3) -- (0.3, -0.3);
\draw[very thick,gray!60,dashed] (-0.3, 0.3) -- (-0.3, -0.3);
\drawHyperbola{0.6}{6}{3.12}{};
\draw[very thick,gray!60] (0.6, 0.1) -- (0.6, -0.1);
\draw[very thick,gray!60] (-0.6, 0.1) -- (-0.6, -0.1);
\drawHyperbola{0.9}{6}{3}{dashed};
\draw[very thick,gray!60,dashed] (0.9, 0.1) -- (0.9, -0.1);
\draw[very thick,gray!60,dashed] (-0.9, 0.1) -- (-0.9, -0.1);
\drawHyperbola{1.2}{6}{2.96}{};
\drawHyperbola{1.5}{6}{2.8}{dashed};
\drawHyperbola{1.8}{6}{2.65}{};
\drawHyperbola{2.1}{6}{2.4}{dashed};
\drawHyperbola{2.4}{6}{2.1}{};
\drawHyperbola{2.7}{6}{1.7}{dashed};
\coordinate (P) at (1.8,3.3); %x軸最小
\node[right,scale = 1.5 ] at (P) {P};
\fill (P) circle ( 0.08) ;
\draw[thick] (P) -- (A);
\draw[thick] (P) -- (B);
\node[scale = 1.5 ] at (0,2.4) {$l_1$};
\node[scale = 1.5 ] at (2.7,2) {$l_2$};
\draw[thick, Stealth-Stealth] (-4.4,0) -- (-5.6,0);
\node[scale = 1.5 ] at (-5.0,-0.3) {$\lambda$};
\end{scope}
%強め合いを示す 双曲線 の インデックス
\draw[thick, ->] (0, 3.8) -- (0,3.6);
\node[scale = 1.0] at ( 0, 4 ) { $ m = 0$} ;
%
\draw[thick, ->] (-1, 3.8) -- (-0.95,3.6);
\node[scale = 1.0] at ( -1, 4 ) { $ m = 1$} ;
%
\draw[thick, ->] (1, 3.8) -- (0.95,3.6);
\node[scale = 1.0] at ( 1, 4 ) { $ m = 1$} ;
%
%弱め合いを示す 双曲線 の インデックス
\draw[thick, ->] (0.5, -3.8) -- (0.45,-3.6);
\node[scale = 1.0] at ( 0.5, -4 ) { $ m = 0$} ;
%
\draw[thick, ->] (-0.5, -3.8) -- (-0.45,-3.6);
\node[scale = 1.0] at ( -0.5, -4 ) { $ m = 0$} ;
%
\draw[thick, ->] (1.5, -3.8) -- (1.4,-3.6);
\node[scale = 1.0] at ( -1.5, -4 ) { $ m = 1$} ;
%
\draw[thick, ->] (-1.5, -3.8) -- (-1.4,-3.6);
\node[scale = 1.0] at ( 1.5, -4 ) { $ m = 1$} ;
\end{tikzpicture}