Numerical calculation of nested integral with no analytical solution
Show older comments
Dear all,
I have a question related to nested integral calculation when the first integral to be calculated has no analytical solution in terms of elemental functions.
The nested integral I would like to solve is:

where there is an integral in the denominator of the integral which has no analytical solution. The limits of this integral in the denominator include
, so cannot be estimated numerically (in a direct manner, but should in the nested integral). Although not related, I could solve this integral numerically by using double integrals in MATLAB (integral2(fun, z1, e/2, 0, v1) command), but this is obviously not applicable since this is not a double but a nested integral.
Thus, the nested integral depends on both v and z (all the other parameters are constants). Doees anyone know if this nested integral can be solved in Matlab? I never tried something like this before. I provide a piece of code and my attempt. Perhaps I am just not correctly typing something and Matlab solves this easily, so please sorry about any mistake (I leave some commented lines which are commands I tried and thought they'd work):
R2=0.00012721; Ox = -8.39166666666673e-05;
theta2 = 0.369784726547689; a = 0.000251315;
D1 = 0.00024821; h1 = 0.000167833333333335;
A = 4.323429908e-07; e = 0.000589216666666665;
%+++++
%+++++Function and limits of integrals+++++
fun= @(z,v) ((R2^2*sin(v).^2)./sqrt(1-((z-Ox)./(a+R2.*cos(v))).^2));
v1 = @(z) (pi - acos((a - z + Ox )./R2)); %this is function of z
z1 = (R2+D1).*cos(theta2)-h1/2; %this is a number
%+++++
% ++++ Attempts +++++
% m=@(z) integral(fun, 0, v1);
% integral(1/(A-2*m), z1, e/2);
%integral(1/(A-2*(integral(@(z,v) ((R2^2*sin(v).^2)./sqrt(1-((z-Ox)./(a+R2.*cos(v))).^2)), 0, v1))), z1, e/2) ;
integral(1/(A-2*(integral(@(z,v) ((R2^2*sin(v).^2)./sqrt(1-((z-Ox)./(a+R2.*cos(v))).^2)), 0, v1))), z1, e/2) ;
From this code, I get the following error:
Error using integral (line 85)
A and B must be floating-point scalars.
Any help is pretty much appreciated since I am a bit desperated. I do not even know whether MATLAB is able to solve this!
Best regards
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation 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!