Numerical integration of a nested integral; limits of inner integral depend on the outer integration variable

7 vues (au cours des 30 derniers jours)
I have 2 nested integrals. I want to integrate a bessel function multiplied by x. And the integration limits depend on the integration variable of the outer intergral.
The outer integral should go till inf. But for simplification i set it to 1e6.
The following code is a example code, which doesnt work. because the integration limits arent scalar values.
This integral doesnt habe a analytical solution so i cant simplify it.
How can i change my implementation to solve this problem?
Thank you!
Bessel_integrand = @(x) x .* besselj(0,x);
Integrand_B = @(a) integral(Bessel_integrand,a * 1, a * 2);
result = integral ( Integrand_B, 0 , 1e6);
Error using integral
Limits of integration must be double or single scalars.

Error in solution (line 2)
Integrand_B = @(a) integral(Bessel_integrand,a * 1, a * 2);

Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);

Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);

Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);

Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);

Réponses (1)

Torsten
Torsten le 8 Mar 2023
Modifié(e) : Torsten le 8 Mar 2023
I'm not sure your integral exists ...
Bessel_integrand = @(x) x .* besselj(0,x);
Integrand_B = @(a) integral(Bessel_integrand,a, 2*a)
Integrand_B = function_handle with value:
@(a)integral(Bessel_integrand,a,2*a)
result = integral(Integrand_B,0,1000,'ArrayValued',true)
result = 17.1918
  1 commentaire
Martin
Martin le 8 Mar 2023
Thanks for the answer! Yes this integral doesnt exist. I forgot a very important part of my simplified code.
Now it works!
Bessel_integrand = @(x) x .* besselj(0,x);
Integrand_B = @(a) integral(Bessel_integrand,a, 2*a).^2 * 1/a^4
Integrand_B = function_handle with value:
@(a)integral(Bessel_integrand,a,2*a).^2*1/a^4
result = integral(Integrand_B,0,1000,'ArrayValued',true)
result = 1.8843

Connectez-vous pour commenter.

Catégories

En savoir plus sur Bessel functions dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by