How to simulate precession?
17 次查看(过去 30 天)
显示 更早的评论
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 个评论
Hano
2016-9-30
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.
采纳的回答
Star Strider
2015-7-27
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 个评论
Star Strider
2015-7-27
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.)
更多回答(1 个)
Muthu Annamalai
2015-7-27
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>
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!