1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
%=======================================================================
% Cette fonction plotte les harmoniques sphériques à la
% surface d'une sphère de rayon unité.
% REMARQUE : par rapport au cas standard : THETA <--> PHI
% et PHI (avant correction) est défini par rapport au vecteur rho(x,y)
% qui est le projeté du vecteur r(x,y,z) dans le plan x-y.
% Après correction (PHI = pi/2 - PHI), PHI est défini par rapport à l'axe z
% (voir la doc matlab "cart2sph")
% INPUT : L = 0,1,2,... et M = 0,1,...,L
% OUTPUT : X,Y,Z et THETA,PHI,Ymn
%=======================================================================
function [X,Y,Z,THETA,PHI,Ymn]=harmonic(L,M)
[X,Y,Z] = sphere(100,100);
[THETA,PHI,R] = cart2sph(X,Y,Z);
PHI = pi/2 - PHI;
Lmn=legendre(L,cos(PHI));
if L~=0
Lmn=squeeze(Lmn(M+1,:,:));
end
a1=((2*L+1)/(4*pi));
a2=factorial(L-M)/factorial(L+M);
C=sqrt(a1*a2);
Ymn=C*Lmn.*exp(1i*M*THETA);
axis off; hold on;
axes('position',[0.0499 0 0.2666 1]);
surf(X,Y,Z,real(Ymn));
shading interp
axis equal;
axes('position',[0.3666 0 0.2666 1]);
surf(X,Y,Z,imag(Ymn));
shading interp
axis equal;
axes('position',[0.6833 0 0.2666 1]);
surf(X,Y,Z,abs(Ymn).^2);
shading interp
axis equal;
axes('position',[0 0.9 1 0.1]); axis off;
t(1)=text(0.50,0.25,'HARMONIQUES SPHERIQUES','HorizontalAlignment','Center');
axes('position',[0 0 1 0.1]); axis off;
t(2)=text(0.20,1.5,['Real(Y^',num2str(M),'_',num2str(L),')'],'HorizontalAlignment','Center');
t(3)=text(0.50,1.5,['Imag(Y^',num2str(M),'_',num2str(L),')'],'HorizontalAlignment','Center');
t(4)=text(0.80,1.5,['|Y^',num2str(M),'_',num2str(L),'|^2'],'HorizontalAlignment','Center');
return |
Partager