File:2SlitInterference.gif
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
2SlitInterference.gif (284 × 285 pixels, file size: 1 MB, MIME type: image/gif, looped, 180 frames, 18 s)
File information
Structured data
Captions
Summary
[edit]Description2SlitInterference.gif |
English: Animation of the interference of waves originating from grating slits.
Deutsch: Animation der Überlagerung von Wellen eines Mehrfachspalts/Gitters. |
Date | |
Source | Own work |
Author | And1mu |
Source Code
[edit]created with LaTeX and PGF/TikZ |
---|
Script to create the animations for different gratings: #!/bin/bash
set -e
DIR="animate"
FILE="tikz.tex"
#for SLOTS in 2 3 4 5 10 20 30 ; do
for SLOTS in 2 3 4 5 10 20 30 ; do
NUM=0
rm ${DIR}/frame???.png
sed -i "s/\\\def\\\lines{.\+}/\\\def\\\lines{$SLOTS}/" tikz.tex
for ANG in $(seq 0 2 358) ; do
echo "Creating frame $NUM for $SLOTS lines ..."
sed -i "s/\\\def\\\PhaseDiff{.\+}/\\\def\\\PhaseDiff{$ANG}/" tikz.tex
pdflatex -shell-escape tikz.tex 1> /dev/null
echo "Convert to png ..."
NUMSTR=$(printf "%03d" $NUM)
convert -shave 3x3 tikz.svg ${DIR}/frame${NUMSTR}.png
NUM=$(($NUM+1))
done
cd $DIR
convert -delay 10 -loop 0 frame*.png ${SLOTS}SlitInterference.gif
cd -
done
The code to create a single frame (tikz.tex): \documentclass[crop,border=3,tikz,convert={outext=.svg,command=\unexpanded{pdf2svg \infile\space\outfile}},multi=false]{standalone}
\usepackage{ifthen}
\usetikzlibrary{math}
\usetikzlibrary{calc,through,shapes}
\pgfkeys{/tikz/savelength/.code 2 args={\global\edef#1{#2}}}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\def\lines{40}
\def\omegat{20}
\def\PhaseDiff{359}
\begin{document}
\begin{tikzpicture}[>=latex]
\tikzmath{\D=\PhaseDiff;}
\draw[gray,->] (0,-4) -- (0,4);
\draw[gray,->] (-4,0) -- (4,0);
\coordinate (A) at (0,0);
\tikzmath{\Amp=5/\lines;}
\coordinate (B) at (\omegat:\Amp);
\foreach \a in {1,...,\lines}{
\draw[ultra thick,->,blue] (A) -- (B);
\coordinate (A) at (B);
\coordinate (F) at (B);
\coordinate (B) at ($ (B)+(\a*\D+\omegat:\Amp) $);
}
\node()[anchor=north east] at (5,5){\LARGE $\delta=\D^\circ$};
\path let \p1=(F), \n1={veclen(\x1,\y1)} in [savelength={\n}{\n1}];
% \node at (2,2){\n};
\ifthenelse{\lengthtest{\n < 8 pt}}{
\draw[ultra thick,red,tips=proper] (0,0) -- (F);
\ifthenelse{\lengthtest{\n < 1 pt}}{
\draw[ultra thick] (0,0) circle (1);
%\node at (-1.5,-1.5){Minimum};
}{}
}{
\draw[ultra thick,red,->,tips=proper] (0,0) -- (F);
}
\begin{pgfonlayer}{background}
\draw[fill=white] (-5.1,-5.1) rectangle (5.1,5.1);
\path[fill=red!30] let \p1=(F), \n1={veclen(\x1,\y1)} in (0,0) circle[radius=\n1];
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 20:26, 20 March 2016 | 284 × 285 (1 MB) | And1mu (talk | contribs) | minor improvements: mark minima, fix arrow head for short lengths | |
13:36, 16 March 2016 | 284 × 285 (1 MB) | And1mu (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following 6 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikibooks.org