how to evaluate the integral of the expression involving bessel functions.
Mostrar comentarios más antiguos
I have the following expression which i need to find.

then how i can find the integration? here this k is vector which contain k0,k1,k2, and same d and e is also a vector which contain d1,d2,d3 and e1, e2 ,e3 . and
is also given. Then how i can evaluate this integration.
2 comentarios
Why is psi a function of r ?
Which index p is meant when you write nu_D(r)*abs(nu_D(r))*besselj(chi_p^l * r) r as the integrand ?
Do you have functions to compute the derivatives of besselj and besseli ?
Why does your vector k has only 3 elements instead of 4 for k0,k1,k2 and k3 ?
Javeria
el 18 de Jul. de 2025
Respuestas (2)
Shishir Reddy
el 18 de Jul. de 2025
Editada: Shishir Reddy
el 18 de Jul. de 2025
Hi @Javeria
Kindly refer the following steps to numerically evaluate the given integral using MATLAB.
1. Define the Parameters:
% Given values
RI = 0.21;
k = [0.281, 0.2, 0.1];
d = [0.1, 0.3, 0.4]; % d0, d1, d2, d3 → d(1), d(2), d(3), d(4)
e = [0.3, 0.09, 0.7];
chi = [0.01, 0.03, 0.02];
2. Define ν_D(r):
nu_D = @(r) ...
d(1) * besselj(0, k(1)*r) / besselj(0, k(1)*RI) + ...
d(2) * besseli(1, k(2)*r) / besseli(1, k(2)*RI) + ...
d(3) * besseli(1, k(3)*r) / besseli(1, k(3)*RI) + ...
e(1) * besselj(1, chi(1)*r) / besselj(1, chi(1)*RI) + ...
e(2) * besselj(1, chi(2)*r) / besselj(1, chi(2)*RI) + ...
e(3) * besselj(1, chi(3)*r) / besselj(1, chi(3)*RI);
3. Define the Integrand Function:
chi1 = chi(1);
integrand = @(r) abs(nu_D(r)).^2 .* besselj(0, chi1 * r);
4. Use 'integral' to compute the result:
psi = integral(integrand, 0, RI);
disp(['ψ = ', num2str(psi)]);
For more information regarding 'integral' function, kindly refer the following documentation -
I hope this helps.
1 comentario
Javeria
el 18 de Jul. de 2025
l = 0;
R_I = 2;
N = 3;
P = 3;
k = [0.28,0.2,0.1,0.05]; %[k0,k1,k2,k3]
e = [0.3,0.9,0.7]; %[e1,e2,e3]
d = [0.1,0.3,0.4,0.5]; %[d0,d1,d2,d3]
chi = [0.01,0.03,0.02]; %[chi1,chi2,chi3]
format long
psi = integral(@(r)fun(r,l,R_I,N,P,k,e,d,chi),0,R_I)
function values = fun(r,l,R_I,N,P,k,e,d,chi)
nu_D_values = nu_D(r,l,R_I,N,P,k,e,d,chi);
chip = chi(end); %-> which p-index from p has to be taken here ?
values = nu_D_values.*abs(nu_D_values).*besselj(l,chip*r).*r;
end
function nu_D_values = nu_D(r,l,R_I,N,P,k,e,d,chi)
nu_D_values = d(1)*besselj(l,k(1)*r)/dbesselj(l,k(1)*R_I);
for n = 1:N
nu_D_values = nu_D_values + d(n+1)*besseli(l,k(n+1)*r)/dbesseli(l,k(n+1)*R_I);
end
for p = 1:P
nu_D_values = nu_D_values + e(p)*chi(p)*besselj(l,chi(p)*r)/dbesselj(l,chi(p)*R_I);
end
end
function value = dbesseli(nu,z)
value = 0.5*(besseli(nu-1,z) + besseli(nu+1,z));
%value = nu./z.*besseli(nu,z) + besseli(nu+1,z);
end
function value = dbesselj(nu,z)
value = 0.5*(besselj(nu-1,z) - besselj(nu+1,z));
%value = nu./z.*besselj(nu,z) - besselj(nu+1,z);
end
5 comentarios
Javeria
el 20 de Jul. de 2025
If you have a function f(x) and you want to take the derivative of f at k*x (thus f'(k*x)), you just evaluate f'(x) at k*x.
If you have a function g(x) = f(k*x) and you want to take the derivative of g at x, it's necessary to use the chain rule - thus g'(x) = k*f'(k*x).
In your case, you want to take the derivative of f at k*x, not the derivative of g at x. Thus the inner derivatives (wk, k and chi) in the denominator of your expressions are wrong in my opinion.
You can also make the dimensional test to see which version is correct: wk*dbesselj(l, wk*RI), k(nidx)* dbesseli(l, k(nidx)*RI) and chi(qidx)*dbesselj(l, chi(qidx)*RI) have unit 1/m, dbesselj(l, wk*RI), dbesseli(l, k(nidx)*RI) and dbesselj(l, chi(qidx)*RI) have unit 1.
And I would handle [Z0d,Znd] and [wk,k] the same way as you handle d. In your code, you don't reference the first elements of Znd and k, but you could put Z0d and wk at this first position and remove them from the input list. Or you could define d0 and d and additionally put d0 in the input list. The main thing is: handle the cases consistently.
And I wouldn't put it as
integrand = @(r) abs(v_D(N, Q, r, Z0d, wk, RI, l, dn, Znd, k, eq, chi)) ...
.* v_D(N, Q, r, Z0d, wk, RI, l, dn, Znd, k, eq, chi) ...
.* besselj(l, chi(q)*r) .* r;
because this way, your function v_D has to be evaluated two times. Use "integrand" as a function as I did, not as a function handle. The index q for which you want to evaluate chi can easily be passed to this function.
But all in all, you should arrange the code in a way that you understand it - you are the one who has to debug it at the final stage. Especially there is one thing you should remember: use the same variable names in your documentation and in your code - it will make it much easier to compare what you coded and what you should have coded.
Javeria
el 21 de Jul. de 2025
Torsten
el 21 de Jul. de 2025
The first thing that I'd do is to output the matrices A, B, C, D E, F, W, G and H_I and inspect where the entries in the order of 1e13 - 1e29 stem from in your computations.
Categorías
Más información sobre Bessel functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!