File:ZeigerSchwebung.gif
ZeigerSchwebung.gif (505 × 323 pixels, file size: 1.3 MB, MIME type: image/gif, looped, 120 frames, 6.0 s)
File information
Structured data
Captions
Summary
editDescriptionZeigerSchwebung.gif |
English: Beat (acoustics) explained with rotating pointers
Deutsch: Zeigerdarstellung einer Schwebung |
Date | |
Source | Own work |
Author | And1mu |
Source Code
editcreated with LaTeX and PGF/TikZ |
---|
Script to create the animation: #!/bin/bash
set -eu
DIR="animate"
FILE="ZeigerSchwebung"
NUM=0
rm -f ${DIR}/frame???.png
for ANG in $(seq 0 15 1790) ; do
echo "Creating frame $NUM ..."
sed -i "s/\\\def\\\omegat{.\+}/\\\def\\\omegat{$ANG}/" ${FILE}.tex
pdflatex -shell-escape ${FILE}.tex 1> /dev/null
echo "Convert to png ..."
NUMSTR=$(printf "%03d" $NUM)
convert -shave 3x3 ${FILE}.svg ${DIR}/frame${NUMSTR}.png
NUM=$(($NUM+1))
done
cd $DIR
convert -delay 5 -loop 0 frame*.png ${FILE}.gif
cd -
The code to create a single frame: \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{1}
\def\omegat{220}
\def\PhaseFactor{1.2}
\def\mypi{3.141592653589793}
\begin{document}
\begin{tikzpicture}[>=latex]
\tikzmath{\omegatR=\omegat/180*\mypi;}
\node[anchor=west] () at (-2,2){\Huge A};
\draw[gray,->] (0,-2.75) -- (0,2) node[anchor=south]{$y$};
\draw[gray,->] (-2,0) -- (2,0) node[anchor=west]{$x$};
\coordinate (A) at (0,0);
\coordinate (B) at (\omegat:2);
\coordinate (Bext) at ($ (A)!2!(B) $);
\draw[ultra thick,->,blue] (A) -- (B);
\draw[thick,blue,smooth,domain=-3:3,samples=50] plot function {-2+0.5*sin(-5*x+\omegatR)};
\begin{scope}[shift={(0,-5.5)}]
\node[anchor=west] () at (-2,2){\Huge B};
\node[anchor=center] () at (4.5,2.5){\Large$\omega_A<\omega_B$};
\draw[gray,->] (0,-2.75) -- (0,2) node[anchor=south]{$y$};
\draw[gray,->] (-2,0) -- (2,0) node[anchor=west]{$x$};
\coordinate (A) at (0,0);
\coordinate (B) at (\omegat*\PhaseFactor:2);
\coordinate (Bext) at ($ (A)!2!(B) $);
\draw[ultra thick,->,blue] (A) -- (B);
\draw[thick,blue,smooth,domain=-3:3,samples=50] plot function {-2+0.5*sin(-5*x+\PhaseFactor*\omegatR)};
\end{scope}
\begin{scope}[shift={(10,-2)}]
\node[anchor=south] () at (-3.5,3.5){\Huge A $+$ B};
\draw[gray,->] (0,-6.5) -- (0,4) node[anchor=south]{$y$};
\draw[gray,->] (-4,0) -- (4,0) node[anchor=west]{$x$};
\coordinate (A) at (0,0);
\coordinate (B) at (\omegat:2);
\coordinate (B0) at (B);
\coordinate (Bext) at ($ (A)!2!(B) $);
\coordinate (New) at ($ (B)+(\omegat*\PhaseFactor:2) $);
\draw[thick,->,blue] (A) -- (B);
\coordinate (A) at (B);
\coordinate (B) at (New);
\draw[thick,->,blue] (A) -- (B);
\coordinate (A) at (B);
\path let \p1=(A), \n1={veclen(\x1,\y1)} in [savelength={\n}{\n1}];
\ifthenelse{\lengthtest{\n > 8 pt}}{
\draw[ultra thick,red,->,tips=proper] (0,0) -- (A);
}{
\draw[ultra thick,red] (0,0) -- (A);
}
\draw[thick,blue,smooth,domain=-3:3,samples=50] plot
function {-5.3+0.5*sin(-3*x+\omegatR)};
\draw[thick,blue,smooth,domain=-3:3,samples=50] plot
function {-5.3+0.5*sin(-3*x+\PhaseFactor*\omegatR)};
\draw[ultra thick,red,smooth,domain=-3:3,samples=50] plot function
{-5.3+0.5*sin(-3*x+\omegatR)+0.5*sin(-3*x+\PhaseFactor*\omegatR)};
\begin{pgfonlayer}{background}
\fill[white] (-13.5,-6.75) rectangle (4.5,4.8);
\path[fill=red!30] let \p1=(A) in (0,0) circle ({veclen(\x1,\y1)});
\end{pgfonlayer}
\end{scope}
\end{tikzpicture}
\end{document}
|
Licensing
editI, 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:11, 1 April 2016 | 505 × 323 (1.3 MB) | And1mu (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikibooks.org