10.14.2016

Spherical harmonics ImY

octave octave_functions_SphericalHarmonic_ImY

Function: octave_functions_SphericalHarmonic_ImY ( l, m )

    function out = octave_functions_SphericalHarmonic_ImY( l, m )
    
     seg=64;
    
     theta=linspace(0,pi,seg);
     phi=linspace(0,2*pi,seg);
    
     Theta=theta'*ones(1,seg);
     Phi=ones(seg,1)*phi;
    
     x=sin(Theta).*cos(Phi);
     y=sin(Theta).*sin(Phi);
     z=cos(Theta);
    
     L=legendre(l,cos(theta));
     am=abs(m);
     LL=L(abs(m)+1,:);
     c=(-1)^((m+am)/2)*sqrt((2*l+1)/(4*pi)*factorial(l-am)/factorial(l+am))*LL'*exp(1i*m*phi);
    
     cc=imag(c);
     r=abs(cc);
    
     plot3(r.*x,r.*y,r.*z);
    
     out = l
    
    endfunction
    

Function: legendre ( n, x )

    Compute the Legendre function of degree n and order m = 0 … n. 
    The value n must be a real non-negative integer. 
    x is a vector with real-valued elements in the range [-1, 1].
    

octave octave_functions_SphericalHarmonic_ImY.m

octave octave_functions_SphericalHarmonic_ImY