Bessel function based equation returns NaN as output. Kindly check where I went wrong.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have attached the equation in image format and given the code below. Kindly help me find in which function i did mistake- bessel or sinh or exp.
EQUATION:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/293871/image.jpeg)
CODE:
I1=@(x) besselj(1,x.*sqrt(i/j)).*besselj(1,x.*sqrt(j/i)).*besselj(0,x.*(s/(sqrt(i.*j)))).*((sinh(x.*(aw/i).*sqrt(i/j)))/(x.*(aw/i).*sqrt(i/j))).*((sinh(x.*(aw/j).*sqrt(j/i)))/(x.*(aw/j).*sqrt(j/i))).*(exp(-x.*(z/(sqrt(i.*j)))))
I=integral(I1,0,Inf)
M=pi*u*n1*n2*sqrt(i*j)*I
OUTPUT:
NaN
2 Commenti
David Goodmanson
il 19 Mag 2020
Hi Swathi,
this is almost certainly happening because sinh(z)/z = 1 at z=0, but sinh(z) and z when calculated separately and divided, gives 0/0 =nan. You need to create a function that calculates sinh(z)/z and replaces nan by 1 at z=0.
Incidentally you are missing dots at a couple of locations:
((sinh(x.*(aw/i).*sqrt(i/j)))./(x.*(aw/i).*sqrt(i/j)))
^
and similarly for the other sinh function. Of course this doesn't get you out of the nan problem, it just fixes up the element by element division.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Bessel functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!