MATLAB - solving equation with Bessel function

Click For Summary

Discussion Overview

The discussion revolves around solving an equation involving Bessel functions using MATLAB. Participants explore different methods and functions available in MATLAB for finding solutions to the equation.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant presents the equation involving Bessel functions and expresses difficulty in finding solutions using vpasolve and fzero.
  • Another participant requests the exact code used to identify potential issues, stating that fzero works well for them.
  • A participant acknowledges a misuse of the fzero function and shares corrected code that successfully finds a solution close to their initial guess.
  • It is noted that fzero will only find one solution based on the initial guess provided, and different initial guesses may yield different solutions.
  • Another suggestion is made to use ezplot for rough estimations of where the function intersects the x-axis, which can help in selecting a better initial guess for fzero.

Areas of Agreement / Disagreement

Participants generally agree on the functionality of fzero but acknowledge that it finds only one solution at a time, depending on the initial guess. There is no consensus on the best approach, as different methods are suggested.

Contextual Notes

Participants discuss the limitations of their approaches, including the dependency on initial guesses for fzero and the potential for different solutions based on those guesses. The discussion does not resolve the overall effectiveness of the methods proposed.

Who May Find This Useful

This discussion may be useful for MATLAB users dealing with Bessel functions or similar mathematical equations, particularly those seeking methods for numerical solutions.

kravky
Messages
22
Reaction score
3
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 vpasolve, but it gave me answer x=0 only. fzero function didnt work, too.
What function can solve this equation?

Thanks
 
Physics news on Phys.org
Please show us exactly the code you have tried. Otherwise it is impossible to tell where you might have gone wrong. fzero works perfectly fine for me.
 
Yes. I misused fzero function. now it works for me aswell!
Code:
function ffu = f(x)
ffu = besselj(0,0.5*x)*bessely(0,4.5*x) - besselj(0,4.5*x)*bessely(0,0.5*x);

and fzero
Code:
fun=@f
x0=2;
S=fzero(fun,x0)

will find solution. It finds only one solution which is close to the x0 value but its not the problem.
 
Yes, fzero finds just one solution. It will find different solutions depending on your x0 input.

Also, when you have such a short and simple function, you can just as well define an inline function instead of writing an entire function file.
 
  • Like
Likes   Reactions: kravky
I understand. A good way is to use ezplot as well for a rough estimation of points, where functions is zero (intersection with x axis) and then use this rough guess as x0 input in fzero for precise value
 

Similar threads

Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K