Wrongly oriented plots while drawing spherical harmonics
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Benjamin Kraus
am 12 Jan. 2021
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)
Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!