Wrongly oriented plots while drawing spherical harmonics
5 次查看(过去 30 天)
显示 更早的评论
Hello everyone. I am trying to create a simple app, using appdesigner, that will plot spherical harmonics.
Everything works fine, but in some configurations of quantum numbers (l=3, m= -1 ; l=4, m = -2; l = 5, m= -3) and so on the plot seems to be "differently oriented" which looks kind of odd. I tried to set SortMethod explicitly to 'depth' but it didn't change the result. What is funny, when I set it explicitly to 'childorder' it changed the appearance of all the plots to the unwanted one (all of them were wrongly oriented). I attach my code and pictures of how the plots look like:
syms theta phi l m x;
l = ll;
subs(l);
m = mm;
subs(m);
eq = (x^2 - 1)^(l);
Df = diff(eq,x,l+m);
Plm = (-1)^(m)/(2^(l)*factorial(l))*(1-x^2)^(m/2)*Df;
x = cos(theta);
a = (2*l+1)*factorial(l-m);
b = 4*pi*factorial(l+m);
C = sqrt(a/b);
Ylm = C*subs(Plm)*exp(1i*m*phi);
r = @(phi,theta) abs(Ylm);
x = r*cos(phi)*sin(theta);
y = r*sin(phi)*sin(theta);
z = r*cos(theta);
fsurf(app.UIAxes,x,y,z,[0 2*pi 0 pi]);
app.UIAxes.SortMethod = 'depth';
How it looks like for l = 3, m = 1 (that's the desired appearance)

How it looks like for l = 3, m = -1:

Does anyone know how to solve it? Thanks in advance
Karol
2 个评论
Benjamin Kraus
2021-1-12
Both your pictures are labled with "l = 3, m = -1". Is that a mistake?
Also, what is the output from this command when you run in on both pictures?
rendererinfo(app.UIAxes)
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!