How to find besselh zeros?

1 view (last 30 days)
Omer Hamburger
Omer Hamburger on 26 Apr 2016
Commented: Omer Hamburger on 26 Apr 2016
Hello everyone! I am trying to find a zero of an equation using besselh function. The code I am using is:
f=@(x) (besselh(-1,2,x)*0.5*a-besselh(1,2,x))-besselh(1,1,x)*b;
chi=fsolve(f,x0,opts);
Where a,b,x0 are given, and might be complex. I wish to use this part of code inside of loop so I am not sure if writing a different function to myfun every time is useful. Using fsolve I got an error:
"Error using trustnleqn (line 28) Objective function is returning undefined values at initial point. FSOLVE cannot continue."
Error in fsolve (line 368) [x,FVAL,JACOB,EXITFLAG,OUTPUT,msgData]=...
Using fzero I got: "Error using fzero (line 242) Function values at interval endpoints must be finite and real."
Thank you very much in advance!
Omer

Answers (1)

Torsten
Torsten on 26 Apr 2016
Edited: Torsten on 26 Apr 2016
Split in real and imaginary part and solve both imag(f(z))=0 and real(f(z))=0 simultaneously for z=x+1I*y using fsolve.
Best wishes
Torsten.
  7 Comments
Torsten
Torsten on 26 Apr 2016
Print a, b and a0 before the call to fsolve.
Check whether they are given values.
Best wishes
Torsten.
Omer Hamburger
Omer Hamburger on 26 Apr 2016
Thank you Torsten,
This have been very helpful, I fixed the problem!
Thank you very much,
Omer

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!