MATLAB - solving equation with Bessel function

In summary, The conversation discusses the use of various functions to solve a specific equation. The individual mentions trying vpasolve and fzero, but encountering difficulties. They are then advised to show their code and it is suggested that they may have misused the fzero function. The individual then shares their revised code and mentions that fzero works for them now. It is noted that fzero will only find one solution and can be used with a rough estimation from ezplot for a more precise value.
  • #1
kravky
22
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
  • #2
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.
 
  • #3
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.
 
  • #4
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 kravky
  • #5
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
 

1. How do I use the Bessel function in MATLAB to solve equations?

To use the Bessel function in MATLAB, you can use the 'bessel' command followed by the desired order and argument. For example, to solve the equation J(x)=0, you can use the command 'besselj(0,x)'. This will return the value of x that satisfies the equation.

2. What is the syntax for solving equations with Bessel function in MATLAB?

The syntax for solving equations with Bessel function in MATLAB is 'besselj(nu,x)', where nu is the order of the Bessel function and x is the argument. This will return the value of the Bessel function for the given order and argument.

3. Can I use Bessel function to solve differential equations in MATLAB?

Yes, Bessel function can be used to solve differential equations in MATLAB. You can use the 'besselODE' command to solve a second-order differential equation with Bessel functions as the solution. You will need to provide the order of the Bessel function and the equation to be solved.

4. How do I plot the solution of an equation involving Bessel function in MATLAB?

To plot the solution of an equation involving Bessel function in MATLAB, you can use the 'fplot' command. First, define the equation using the 'besselj' function, and then use 'fplot' to plot the equation over a desired range of x values. You can also use the 'ezplot' command for a quick plot of the solution.

5. Is there a way to speed up the computation of Bessel function in MATLAB?

Yes, you can use the 'besself' command to compute Bessel functions faster in MATLAB. This command uses a fast Fourier transform algorithm to compute the function, which can significantly speed up the computation for large values of the argument. However, it may be less accurate for smaller values of the argument, so it is recommended to use this command only when necessary.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • Differential Equations
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
832
Replies
3
Views
2K
Back
Top