Cannot use besselh as function handle

Hello everyone,
I need to convert a symbolic expression containing besselh functions to MATLAB function handle but I get an error message.
Here is a sample of code:
syms nu z
hankel = symfun(besselh(nu,z),[nu,z]) ;
F = matlabFunction(hankel(nu,z)) ;
It works well but if try to use the function F, I get this messsage:
Undefined function or variable 'besselH1'.
Indeed, the F function is defined as:
@(nu,z)besselH1(nu,z)
I use MATLAB R2019a.
What can I do?

댓글 수: 2

Sigh, yet another function that matlabFunction() messes up on :(
Johnes Ricardo
Johnes Ricardo 2020년 11월 5일
편집: Johnes Ricardo 2020년 11월 10일
I have the same problem, I do not know whats happens, but I used [ besselj(n, x) + 1i*bessely(n, x) ] instead.

댓글을 달려면 로그인하십시오.

답변 (1개)

David Goodmanson
David Goodmanson 2020년 9월 11일

0 개 추천

Hi wbriand,
any reason you can't just define
F = @(nu,z) besselh(nu,1,z)
or
F = @(nu,z) besselh(nu,2,z)
whichever one you want?

댓글 수: 1

The problem is that if you have an expression in which besselh is one component, and you matlabFunction in order to generate code that can be used numerically, then matlabFunction messes up and generates a reference to a function that does not exist at the MATLAB level.
You could deliberately create a real function withthe Rogue name that interfaced back to besselh though.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2020년 9월 10일

편집:

2020년 11월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by