Complicated triple integrals with a small coefficient (order of -7) that disabled MATLAB?

조회 수: 1(최근 30일)
Jianming Wang
Jianming Wang 2021년 1월 31일
댓글: Jianming Wang 2021년 2월 6일
I would like to ask if there are any solutions to solve this problem. I will explain it below. Thank you in advance!
Here is an equation that I want to calculate in MATLAB. The equation is shown in the picture below.
In the equation, there are three integrals. The latter two integrals are in the index (power) of "e", thus must be calculated first. There is another parameter "v" which should be integrated in the former integral on the left side in the second step. Therefore, the latter two integrals should hold the parameter "v" and send it to the former integral. In MATLAB, this can be done by adding "@(v)" when calculating the latter two integrals. I put the code down below.
step1 = @(v)integral2(@(d,phi) 0.0054.*besselj(0,v.*phi.*(30-d)).*phi./(8.*pi.*(1.854-1.848.*cos(phi)).^(3./2)),0,30,0,pi);
step2 = integral(@(v) 3.*exp(-2.5.*10.^(-7).*v.^2-4.53).*besselj(0,0.3.*v).*v.*(exp(step1(v))-1),0,Inf,'ArrayValued',true);
Or, the code can be written in a single line.
result = integral(@(v) 3.*exp(-2.5.*10.^(-7).*v.^2-4.53).*besselj(0,0.3.*v).*v.*(exp(integral2(@(d,phi) 0.0054.*besselj(0,v.*phi.*(30-d)).*phi./(8.*pi.*(1.854-1.848.*cos(phi)).^(3./2)),0,30,0,pi))-1),0,Inf,'ArrayValued',true);
However, if I simulate (run) it, MATLAB never stops. This program is ENDLESS.
After testing, the problem comes from "-2.5.*10.^(-7)" in the first exponent, which is a coefficient of "v". This coefficient is TOO SMALL for such a set of complicated integrals. If I enlarge this coefficient, let's say, make it -2.5.*10.^(0), or -2.5.*10.^(-1), MATLAB can give an answer within a minite.
%use a larger coefficient -2.5.*10.^(-1).*v.^2 or -2.5.*v.^2
result = integral(@(v) 3.*exp(-2.5.*10.^(-1).*v.^2-4.53).*besselj(0,0.3.*v).*v.*(exp(integral2(@(d,phi) 0.0054.*besselj(0,v.*phi.*(30-d)).*phi./(8.*pi.*(1.854-1.848.*cos(phi)).^(3./2)),0,30,0,pi))-1),0,Inf,'ArrayValued',true);
The issue starts from 10.^(-2). MATLAB keeps calculating, with warning:
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
I have no idea how to solve this, because I have to use 10.^(-7) for my calculation.
I am wondering if there is a way to change the equation or the code to another form that MATLAB can deal with.


Shashank Gupta
Shashank Gupta 2021년 2월 5일
Hi Jianming,
The warning which you came across generally arises when the function is not smooth enough and that's why it becomes difficult to converge. if you want a details explaination for the same. Check out this link. It might help you.

Community Treasure Hunt

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

Start Hunting!

Translated by