spherical harmonic representation [message #67227] |
Tue, 21 July 2009 05:07 |
maurya
Messages: 16 Registered: February 2009
|
Junior Member |
|
|
Hi everybody,
I want to display spherical harmonics on a sphere, as given on web
page:
http://en.wikipedia.org/wiki/File:Spherical_harmonics.png (
http://en.wikipedia.org/wiki/Spherical_harmonics )
For this, I have written an IDL routine:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro sph_plot
l=5 ;harmonic degree
m=2 ;azimuthal order |m| <= l
nc=20 ;No. of contours
np = 100 ;No. of inclination angle(theta) and azimuthal angle(phi)
theta=-90+indgen(np)*(90-(-90))/float((np-1)) ;theta = -90,90
phi=-90+indgen(np)*(90-(-90))/float((np-1)) ;phi =-90,90
ff=fltarr(np,np)
for i=0,np-1 do for j=0,np-1 do ff[i,j]=real_part(spher_harm(theta[i]*!
dtor,phi[j]*!dtor,l,m,/doub))
window, 0, xsize = 512, ysize = 512, title = 'Spherical Harmonic'
MAP_SET,/HAMMER, /HORIZON, TITLE= 'Hammer-Aitoff Projection'
mx=max(ff)
lev=-mx+indgen(np)*(mx-(-mx))/float((nc-1)) ;levels: -mx to mx = nc
levels
pve=intarr(nc/2)
nve=intarr(nc/2)+1
contour,ff,theta,phi,/ove,levels=lev,c_linestyle=[pve,nve]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;
But, it is not giving results as expected (as given on the above web
page).
Can anyone help me.
Thanks
|
|
|