Dear all;
I'm working on a project and have need to numerically calculate an overlap integral over r,theta, phi. The function I'm looking at however is also a spherical harmonic (of specific form with l,m). Each coordinate input is a 3D meshgrid as this is being evaluated over a volume.
Currently my integrated function is of the form;
function rY_nm = (R.^n).*spharm(n,m,Theta,Phi); <-- 25ish lines + plotting.assign variable: rY_nm(n,m,Theta,Phi);funintegrall = funtest .*rY_nm.*sin(Theta);inttheta2 = trapz(theta,fint); intphi2 = trapz(phi,inttheta2); intr1(n,mi) = trapz(r,intphi2);
Within a for loop which runs over n,m resulting in a set of coefficients at a each specific intr1(n,m). Here r, theta, phi are the linear coordinates (i.e unmeshed setup).
For my work however I need to use a much higher accuracy numerical method (even at 500x500x500 points the answers aren't following the pattern expected). I have access to a few such as integral and d001ah from the NAG libaries, however these require a function handle as an input which I have zero experience with. I have spent a significant amount of time trying to assign a function handle e.g fint = (R, Theta, Phi) (R.^n) .*spharm(n,m,Theta,Phi) or fint = (R, Theta, Phi,n,m) (R.^n).*spharm(n,m,Theta,Phi) to little success. Would anyone be able to advise or direct me into how i would assign function handles in this type of system?
Best Answer