How to simulate precession?

15 vues (au cours des 30 derniers jours)
Steven
Steven le 27 Juil 2015
Commenté : Hano le 30 Sep 2016
I'm trying to simulate the precession of an electron in the magnetic field as an arrow that rotates around the z-axis in the x-y plane such as http://chemwiki.ucdavis.edu/@api/deki/files/5119/image004.png?revision=1
But how can I plot the arrow rotating at some angle with the z-axis?
Thanks, Steven
  1 commentaire
Hano
Hano le 30 Sep 2016
Hey Steven,
Did you figure out how to correctly plot the precession? I am working on almost the same project and need some more information. (I'll keep looking for different tools, but have to finish it ASAP.)
I would highly appreciate some more explanation. For the project I am working on, the precession should leave a trail, so the final result should look like a sphere.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 27 Juil 2015
I’m not certain what you want, but this should get you started:
N = 20; % Number Of Faces On Sphere
[X,Y,Z] = sphere(N);
axvct = linspace(-1.5, 1.5, N)';
axline = [zeros(N,1) zeros(N,1), axvct];
figure(1)
Sh = surf(X, Y, Z); % Plot Sphere
hold on
Lh = plot3(axline(:,1), axline(:,2), axline(:,3), 'r', 'LineWidth',2) % Plot Sphere Axis
hold off
shading flat
axis equal
rotate(Sh, [1 1 0], 30) % Rotate Sphere
rotate(Lh, [1 1 0], 30) % Rotate Sphere Axis
xlabel('X')
ylabel('Y')
zlabel('Z')
The plot roughly simulates the figure you linked to:
  2 commentaires
Steven
Steven le 27 Juil 2015
Many thanks! I would like to make a simulation where the axis (red line in your figure) precesses (i.e., the top of the axis draws a circle in the x-y plane)
Star Strider
Star Strider le 27 Juil 2015
My pleasure!
That’s certainly possible, but it’s not going to be a trivial exercise. See the documentation for Animation for details. Note that you will also have to rotate the sphere and its axis with respect to the Z-axis (as well as the X and Y axes) as you precess the sphere. You can probably use the plot3 function to draw the circle above the rotating axis.
That seems to me to be a valuable File Exchange contribution when you get it running. The File Exchange contribution Nuclear magnetic resonance simulation might offer some coding examples. (I haven’t run it or looked at its code.)

Connectez-vous pour commenter.

Plus de réponses (1)

Muthu Annamalai
Muthu Annamalai le 27 Juil 2015
MATLAB has lots of tools to plot/visualize the fields/flows, including but not limited to the following,
doc plot3
doc surf
doc contour
vector fields plots,
doc quiver
etc. Ref <http://www.mathworks.com/help/matlab/vector-fields.html>

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by