real-valued spherical harmonics
using real coefficients
 support flexible band intervals
(l=0:dl:L) including both full band
SH (dl=1) and even order only SH (dl=2)
 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
 implement the spherical harmonics
rotation algorithm of Ivanic and Ruedenberg
Bing Jian (2021). Real-Valued Spherical Harmonics (https://www.mathworks.com/matlabcentral/fileexchange/15377-real-valued-spherical-harmonics), MATLAB Central File Exchange. Retrieved .
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).
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:)
The best code ever written for sperical harmonics.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!