How to implement following bessel function in MATLAB
11 views (last 30 days)
Show older comments
Hello all, I am trying to code the following bessel function in MATLAB but not getting it clearly.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1605846/image.png)
where
is the modified Bessel function of second kind, ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1605856/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1605851/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1605856/image.png)
My query is that how can we code equation (1) using two for loops.
Any help in this regard will be highly appreciated.
3 Comments
Star Strider
on 1 Feb 2024
Try running it! That is the only way you will ever know for sure. Does it give reasonable results?
Accepted Answer
John D'Errico
on 1 Feb 2024
Edited: John D'Errico
on 1 Feb 2024
Seriously, READ THE HELP!
help besselk
What does the very first line say? Modified Bessel function of the second kind. So, yes.
The order nu, is M_0-i-j. You did that.
The argument, z, you gave as:
(2*(sqrt(((m_1)+(m_2))*(m_0))))
The only thing I would do is CUT THE PARENS! Having too many parens can make your code impossible to read. This next does as well:
2*sqrt((m_1 + m_2)*m_0)
Really, did you really need parens around each variable name?
A = besselk(m_0 - i - j, 2*sqrt((m_1 + m_2)*m_0));
Even the artful use of whitespace can make your code more easily read. And since you will need to read your own code to be able to debug that code, that is important.
If you cannot even read your own code, that should tell you something.
More Answers (0)
See Also
Categories
Find more on Bessel functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!