cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Spherical Harmonics and Optimization

MoeSzyslak
4-Participant

Spherical Harmonics and Optimization

Hi, All --

I am trying to use spherical harmonics to represent a surface in 3D. The worksheet calculates through without error, but the results are off by ~24 orders of magnitude (for 12th degree Legendre polynomials). I note also that the magnitude of the answer increases with the degree of the polynomials.

Anybody have any ideas? Maybe there's a better way to approach this altogether?

Thanks in advance.

Matt

4 REPLIES 4
MoeSzyslak
4-Participant
(To:MoeSzyslak)

All -- just thought I would give this a "bump" before allowing it to die a peaceful death. For what it is worth, I am attempting to implement the algorithm illustrated in Section 3.1 of this document:

http://www.stat.wisc.edu/~mchung/papers/3DPVT.2006.pdf

Again, thanks in advance.

MAtt

I think you are just trying to fit a function with a degree that is far too big. Try setting Lmax to 1 or 2.

Alan

Alan -- genius! Thanks for the help -- that gets me quite a bit closer. That said, there are still a couple of issues that I can see:

1. The fit isn't very good -- it almost looks as if one of the "clouds" is rotated relative to the other, but I am using sph2xyz and xyz2sph, so I would expect that the two coordinate systems are consistent.

2. In the double sum [R(theta,phi)], 'm' is supposed to range from -l to l, but clearly, this doesn't work when accessing elements of the array 'a' via subscripting. My workaround is to take |m|, but this doesn't seem right. Thoughts?

I've never really played with spherical harmonics much, so I am learning as I go.

Matt

On 1. - no idea!

On 2. When you assign values to "a" try using a[l,m+l (i.e. second subscript is m + l (l not 1). Include this when using "a" in R as well, of course. Doesn't really make any difference to the end result though!

Alan

Top Tags