sh = sphharm(x,y,z,n,m);
0001 function sh = sphharm(x,y,z,n,m); 0002 %sh = sphharm(x,y,z,n,m); 0003 [az,el,r] = cart2sph(x,y,z); 0004 el = (pi/2)*ones(size(el,1),size(el,2)) - el; 0005 0006 for i = 1:size(el,1) 0007 ass = legendre(n,cos(el(i,:))); 0008 if m >= 0 0009 sh(i,:) = ass(m+1,:).*cos(m*(az(i,:))); 0010 else 0011 sh(i,:) = -ass(abs(m)+1,:).*sin(m*(az(i,:))); 0012 end; 0013 end;