How to simulate precession?

조회 수: 16 (최근 30일)
Steven
Steven 2015년 7월 27일
댓글: Hano 2016년 9월 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
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
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
Steven
Steven 2015년 7월 27일
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 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
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>

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by