Continue to Site

# SPHERICAL BESSEL FUNCTION IN MATLAB

Status
Not open for further replies.

#### rastors23

##### Newbie
Hello scholars,
I am working on spherical particles. I noticed there is difference, for instance, z = 0:0.2:1 besselj(1,z) (MATLAB) and z = {0, 0.2, 1} J = SphericalBesselJ[1, z] (Mathematica). I need to compute the spherical bessel function and its derivate of a function using MATLAB. How do I write the code for this especially when the z value has a complex number.

i would stick with mathematica

you might try this:
or this:

i expect you can google these things as well as i can

in any case, check the matlab result with the mathematica result
and be sure you ask both to do the same thing

Many thanks. I finally got it done myself by using MATLAB. I compared the results from MATLAB and Mathematica. MATLAB actually mislead/misinterpret spherical Bessel function (j(n,z)). MATLAB “only” has in-built function for Bessel function (J(n,z)). So, the mistake was they used besselj(n,z) instead of besselJ(n,z). Hence, the results differ. You can convert from Bessel function to Spherical Bessel function using the relations.

I hope this help for the future reference.

Status
Not open for further replies.