My goal is to visualize damped magnetic precession.
Wikipedia features an image, but it doesn't quite capture one essential constraint.
Namely, that the magnetization M should be normalized. So the curve shown in the following picture should lie on the sphere.
So what I want to show is:
- The vectors M and H_eff with M on the sphere.
- A spiral lying on a sphere.
- -M x H_eff being orthogonal to M and H_eff
- M x dM/dt pointing towards H_eff (This is not exactly correct, but rather an approximation).
The tangent of the spiral at the endpoint of M should be a linear combination of MxdM/dt and -MxH_eff (to be more exact: alpha MxdM/dt – MxH_eff for some positive alpha), so the picture on Wikipedia looks fine concerning this requirement.
I have found a similar picture in the following answer:
https://tex.stackexchange.com/a/56617/50081
How can this be achieved with any of the modern plotting tools for LaTeX?
Edit:
As Christian pointed out one could start by generating the spiral via projection of a flat spiral. This is my first try using pgfplots.
\documentclass{minimal}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\xdef\w{10}
\begin{axis}[%
axis equal,
axis lines = none,
xlabel = {$x$},
ylabel = {$y$},
zlabel = {$z$},
enlargelimits = 0.5,
ticks=none,
]
\addplot3[%
opacity = 0.2,
surf,
z buffer = sort,
samples = 21,
variable = \u,
variable y = \v,
domain = 0:180,
y domain = 0:360,
]
({cos(u)*sin(v)}, {sin(u)*sin(v)}, {cos(v)});
\addplot3+[color=blue,domain=0:4*pi, samples=100, samples y=0,no marks, smooth](
{x*cos(deg(x))/sqrt(\w*\w+x*x)},
{x*-sin(deg(x))/sqrt(\w*\w+x*x)},
{\w/sqrt(\w*\w+x*x)}
);
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
Here's an attempt using Asymptote. I took literally your statement that "any spirally shape" would be okay. To compile it, save the code below in a file called (e.g.)
filename.tex
and then runpdflatex --shell-escape filename
. (Also, make sure you have Asymptote installed.)The result: