Solving equation with bessel function

14 views (last 30 days)
Hello, i am trying to solve this equation for x
besselj(0,0.5*x)*bessely(0,4.5*x) - besselj(0,4.5*x)*bessely(0,0.5*x) ==0;
I tried to use vpasolve but matlab gave me answer only x=0. fzero function didnt work too.
What function should i use for solving this equation?

Accepted Answer

Stephan
Stephan on 1 Jan 2019
Hi,
define the area you are interested in and loop through:
syms x
eqn = besselj(0,0.5*x)*bessely(0,4.5*x) - besselj(0,4.5*x)*bessely(0,0.5*x);
fplot(eqn)
fun = matlabFunction(eqn);
x0 = [0.5:1.5:10];
for k = 1:numel(x0)
sol(k) = fsolve(fun,x0(k));
end
sol = sol'
as suggested by John, who was 2 Minutes faster. A good stepwide can be found by looking at the plot.
Best regards
Stephan

More Answers (1)

John D'Errico
John D'Errico on 1 Jan 2019
fun = @(x) besselj(0,0.5*x).*bessely(0,4.5*x) - besselj(0,4.5*x).*bessely(0,0.5*x);
ezplot(fun)
grid on
untitled.jpg
How many of what appear to be infinitely many solutions would you want to find?
An important thing to remember is these solutions tend to be approximately periodic, usually with a period of something like pi/4. That is the case here. In fact, n*pi/4 is a very good approximation to each root, for positive integer n.
So just start fzero out with a starting value of that form, and you will find each root.
x0 = 5*pi/4
x0 =
3.92699081698724
[xloc,fval] = fzero(fun,x0)
xloc =
3.91419012758652
fval =
-1.45716771982052e-16
A simple loop would now suffice.
  2 Comments
Josh Philipson
Josh Philipson on 10 Jan 2020
I just want to thank John D'Errico for his tireless support on such a wide range of details and questions. You will likely never know how many people you have helped and effected. So very much appreciated. Kudos and deep gratitude to you. Thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!