Fretschi
20-03-2024, 22:40
Moin zusammen,
Gibt es einen eleganteren Weg, die Sinuskurve im unteren Bereich zu animieren? Tue mir mit dem Plotten von Funktionen welche nicht im Ursprung beginnen noch immer schwer.
Hab einen Teil vom Code durch Recherche gefunden und angepasst. Habe an zwei Stellen einen Kommentar hinterlassen, wo ich nicht genau verstehe was geschieht.
Schon mal vielen Dank für hilfreiche Tipps!
Grüße
\documentclass[ paper=a4,
twocolumn=false,
captions=tableheading,
oneside,
BCOR = 12mm,
%14pt,
toc=listof,
toc=index,
toc=bibliography,
%landscape,
%openright,
pointlessnumbers,
DIV=15
]
{scrbook}
\usepackage[ansinew]{inputenc}
\usepackage[table,xcdraw,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage{animate}
\newcounter{angle}
\setcounter{angle}{0}
\begin{document}
\begin{center}
\begin{animateinline}[loop, poster = first, controls]{30}
\whiledo{\theangle<359}{
\begin{tikzpicture}
%\draw[step=0.1cm,black!20!white,very thin] (-3,-10) grid++ (6,8);
%\draw[step=0.5cm,black!20!white,] (-3,-10) grid++ (6,8);
\draw (-3,-10) rectangle (4,3);
\draw[thick,->] (-2,0)--(2,0) node[below] {$x$};
\draw[thick,->] (0,-2)--(0,2) node[left] {$y$};
\draw[red,thick] (0,0) circle (1.5cm);
\node[red,below] at (1.6,0) {1};
\node[red,above] at (0.1,-1.5) {1};
%
\draw[ultra thick,cyan] (0,0) -- (0,0 |- \theangle:1.5cm); % Was geschied hier?
\draw[ultra thick,orange] (0,0) -- (\theangle:1.5cm |- 0,0); % Was geschied hier?
%
\draw[densely dotted,orange] (\theangle:1.5cm) -- (\theangle:1.5cm |- 0,0);
\draw[densely dotted,cyan] (\theangle:1.5cm) -- (0,0 |- \theangle:1.5cm);
\draw[ultra thick,red,->,rotate=\theangle] (0,0) -- (1.5,0);
\draw[->] (0.5,0) arc [start angle=0, delta angle=\theangle, radius=0.5cm];
\draw (0.75,0.25) node[anchor= south west]{$\;\varphi = \omega t + \varphi_0$};
\draw[red,orange] (2,1) node {\theangle};
\fill[black] (0,0) circle (1mm);
\draw (1.5,-2.5) circle (0.5mm);
\draw[rotate=-90,xshift=2.5cm,yshift=1.5cm] (0,0) cos++ (1.5,-1.5) sin++ (1.5,-1.5) cos++(1.5,1.5) sin++(1.5,1.5);
\ifthenelse{\theangle>21}{
\draw (1.5,-2.5) circle (0.5mm);
};
\ifthenelse{\theangle>20}{
\draw (1.4,-2.85) circle (0.5mm);
};
\ifthenelse{\theangle>29}{
\draw (1.3,-3.) circle (0.5mm);
};
\ifthenelse{\theangle>36}{
\draw (1.2,-3.12) circle (0.5mm);
};
\ifthenelse{\theangle>42}{
\draw (1.1,-3.22) circle (0.5mm);
};
\ifthenelse{\theangle>47}{
\draw (1.,-3.3) circle (0.5mm);
};
\ifthenelse{\theangle>52}{
\draw (0.9,-3.37) circle (0.5mm);
};
\ifthenelse{\theangle>57}{
\draw (0.8,-3.47) circle (0.5mm);
};
\ifthenelse{\theangle>61}{
\draw (0.7,-3.53) circle (0.5mm);
};
\ifthenelse{\theangle>65}{
\draw (0.6,-3.605) circle (0.5mm) ;
};
\ifthenelse{\theangle>69}{
\draw (0.5,-3.67) circle (0.5mm);
};
\ifthenelse{\theangle>74}{
\draw (0.4,-3.74) circle (0.5mm);
};
\ifthenelse{\theangle>78}{
\draw (0.3,-3.8) circle (0.5mm);
};
\ifthenelse{\theangle>81}{
\draw (.2,-3.87) circle (0.5mm);
};
\ifthenelse{\theangle>85}{
\draw (.1,-3.93) circle (0.5mm);
};
\ifthenelse{\theangle>89}{
\draw (0,-4.0) circle (0.5mm);
};
\ifthenelse{\theangle>93}{
\draw (-.1,-4.07) circle (0.5mm);
};
\ifthenelse{\theangle>97}{
\draw (-.2,-4.13) circle (0.5mm)node[below]{18};
};
\end{tikzpicture}
\stepcounter{angle}
\ifthenelse{\theangle<359}{
\newframe
}{
\end{animateinline}
}
}
\end{center}
\end{document}
Gibt es einen eleganteren Weg, die Sinuskurve im unteren Bereich zu animieren? Tue mir mit dem Plotten von Funktionen welche nicht im Ursprung beginnen noch immer schwer.
Hab einen Teil vom Code durch Recherche gefunden und angepasst. Habe an zwei Stellen einen Kommentar hinterlassen, wo ich nicht genau verstehe was geschieht.
Schon mal vielen Dank für hilfreiche Tipps!
Grüße
\documentclass[ paper=a4,
twocolumn=false,
captions=tableheading,
oneside,
BCOR = 12mm,
%14pt,
toc=listof,
toc=index,
toc=bibliography,
%landscape,
%openright,
pointlessnumbers,
DIV=15
]
{scrbook}
\usepackage[ansinew]{inputenc}
\usepackage[table,xcdraw,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage{animate}
\newcounter{angle}
\setcounter{angle}{0}
\begin{document}
\begin{center}
\begin{animateinline}[loop, poster = first, controls]{30}
\whiledo{\theangle<359}{
\begin{tikzpicture}
%\draw[step=0.1cm,black!20!white,very thin] (-3,-10) grid++ (6,8);
%\draw[step=0.5cm,black!20!white,] (-3,-10) grid++ (6,8);
\draw (-3,-10) rectangle (4,3);
\draw[thick,->] (-2,0)--(2,0) node[below] {$x$};
\draw[thick,->] (0,-2)--(0,2) node[left] {$y$};
\draw[red,thick] (0,0) circle (1.5cm);
\node[red,below] at (1.6,0) {1};
\node[red,above] at (0.1,-1.5) {1};
%
\draw[ultra thick,cyan] (0,0) -- (0,0 |- \theangle:1.5cm); % Was geschied hier?
\draw[ultra thick,orange] (0,0) -- (\theangle:1.5cm |- 0,0); % Was geschied hier?
%
\draw[densely dotted,orange] (\theangle:1.5cm) -- (\theangle:1.5cm |- 0,0);
\draw[densely dotted,cyan] (\theangle:1.5cm) -- (0,0 |- \theangle:1.5cm);
\draw[ultra thick,red,->,rotate=\theangle] (0,0) -- (1.5,0);
\draw[->] (0.5,0) arc [start angle=0, delta angle=\theangle, radius=0.5cm];
\draw (0.75,0.25) node[anchor= south west]{$\;\varphi = \omega t + \varphi_0$};
\draw[red,orange] (2,1) node {\theangle};
\fill[black] (0,0) circle (1mm);
\draw (1.5,-2.5) circle (0.5mm);
\draw[rotate=-90,xshift=2.5cm,yshift=1.5cm] (0,0) cos++ (1.5,-1.5) sin++ (1.5,-1.5) cos++(1.5,1.5) sin++(1.5,1.5);
\ifthenelse{\theangle>21}{
\draw (1.5,-2.5) circle (0.5mm);
};
\ifthenelse{\theangle>20}{
\draw (1.4,-2.85) circle (0.5mm);
};
\ifthenelse{\theangle>29}{
\draw (1.3,-3.) circle (0.5mm);
};
\ifthenelse{\theangle>36}{
\draw (1.2,-3.12) circle (0.5mm);
};
\ifthenelse{\theangle>42}{
\draw (1.1,-3.22) circle (0.5mm);
};
\ifthenelse{\theangle>47}{
\draw (1.,-3.3) circle (0.5mm);
};
\ifthenelse{\theangle>52}{
\draw (0.9,-3.37) circle (0.5mm);
};
\ifthenelse{\theangle>57}{
\draw (0.8,-3.47) circle (0.5mm);
};
\ifthenelse{\theangle>61}{
\draw (0.7,-3.53) circle (0.5mm);
};
\ifthenelse{\theangle>65}{
\draw (0.6,-3.605) circle (0.5mm) ;
};
\ifthenelse{\theangle>69}{
\draw (0.5,-3.67) circle (0.5mm);
};
\ifthenelse{\theangle>74}{
\draw (0.4,-3.74) circle (0.5mm);
};
\ifthenelse{\theangle>78}{
\draw (0.3,-3.8) circle (0.5mm);
};
\ifthenelse{\theangle>81}{
\draw (.2,-3.87) circle (0.5mm);
};
\ifthenelse{\theangle>85}{
\draw (.1,-3.93) circle (0.5mm);
};
\ifthenelse{\theangle>89}{
\draw (0,-4.0) circle (0.5mm);
};
\ifthenelse{\theangle>93}{
\draw (-.1,-4.07) circle (0.5mm);
};
\ifthenelse{\theangle>97}{
\draw (-.2,-4.13) circle (0.5mm)node[below]{18};
};
\end{tikzpicture}
\stepcounter{angle}
\ifthenelse{\theangle<359}{
\newframe
}{
\end{animateinline}
}
}
\end{center}
\end{document}