File Exchange

## Real-Valued Spherical Harmonics

version 1.0.0.0 (12.3 KB) by
some useful spherical harmonics routines

Updated 10 Apr 2016

Features:
[1] real-valued spherical harmonics
using real coefficients
[2] support flexible band intervals
(l=0:dl:L) including both full band
SH (dl=1) and even order only SH (dl=2)
[3] evaluate both function values
f(theta,phi) and the derivatives
of f w.r.t theta and phi. Can be used
for finding peaks of spherical functions
[4] implement the spherical harmonics
rotation algorithm of Ivanic and Ruedenberg

### Cite As

Bing Jian (2021). Real-Valued Spherical Harmonics (https://www.mathworks.com/matlabcentral/fileexchange/15377-real-valued-spherical-harmonics), MATLAB Central File Exchange. Retrieved .

siti bahari

Hi there

thank you for providing this code for calculating real valued of SH. I would like to ask you about "real_spherical_harmonics(angles, coeff, degree, dl)" code is the same as calculation of real degrees of n(k)m for given spherical cap where P_m(n(k)m)cos theta = 0 for k-m is odd and dp_m(n(k)m) cos theta./dtheta = 0 for k-m is even?

I refer to the paper by G.V. Haines (1988).

Boyuan Liu

I think there's a bug for the SHRotate.m, where the computation for R1 matrix is incorrect. Need to recheck the first order spherical harmonic bases for this algorithm. I think some minus signs should be put in front of these matrix coefficients. Because the 1st order bases are actually (m from -1 to 1): -sin(theta)sin(phi), cos(theta), sin(theta)cos(phi).

However, it is a good code:)

Léonard Roussel

haha

Ritwik Kumar

The best code ever written for sperical harmonics.

##### MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
##### Platform Compatibility
Windows macOS Linux