First Derivative of Hankel Function
19 views (last 30 days)
Show older comments
I need to evaluate the first derivative of the spherical hankel function. The DIFF function can calculate this for a given array, but then I can not evaluate the derivative at a point of my choice. Does anyone know of a simple way to do this, or have a relevant m-file. This is the code I use for this purpose, but it can do right for bessel function (jb1) but do not for hankel of first(jh1) and second order(jh2).
jb1 = sym('sqrt(1/2*pi/x)*besselj(n+1/2,x)')
jh1 = sym('sqrt(1/2*pi/x)*besselh(n+1/2,1,x)')
jh2 = sym('sqrt(1/2*pi/x)*besselh(n+1/2,2,x)')
djb1 = simplify(diff(jb1))
djh1 = simplify(diff(jh1))
djh2 = simplify(diff(jh2))
djb1 = vectorize(inline(char(djb1),'n','x'))
djh1 = vectorize(inline(char(djh1),'n','x'))
djh2 = vectorize(inline(char(djh2),'n','x'))
A21=djb1(0,2)
A22=djh1(0,2)
A23=djh2(0,2)
A21 returns an acceptable answer but A22 and A23 report the below error:
Error using inlineeval (line 14)
Error in inline expression ==> (2.^(1./2).*pi.^(1./2).*(2.*x.*D([3], besselh)(n + 1./2, 1, x) - besselh(n + 1./2, 1, x)))./(4.*x.^2.*(1./x).^(1./2))
Error: ()-indexing must appear last in an index expression.
Error in inline/subsref (line 23)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error: A22=djh1(0,2)
Thanks,
Hamed
0 Comments
Answers (0)
See Also
Categories
Find more on Bessel functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!