How to numerically evaluate this singular integral in integral2?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am trying to numerically evaluate a 2D integral with an integrand singular along an elliptical curve, please see the simple code below
a = 1;
b = 2;
c = 3;
k = @(x,y) 1./(sqrt(x.^2/a^2+y.^2/b^2)-c);
h = integral2(@(x,y) k(x,y) ,0,10,-10,10);
This yields warnings that "the result fails the global error test" which is evidently because the integrand is singular when
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1766229/image.png)
I am curious as to how this integral can be restated to make a numerical integration tractable?
Thanks!
5 commentaires
Matt J
le 5 Sep 2024
Modifié(e) : Matt J
le 5 Sep 2024
Let us make the change of variables,
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1767299/image.png)
Then the integral becomes,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1767289/image.png)
Now, converting to polar coordinates,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1767304/image.png)
which is obviously a non-convergent integral if and only if
for any
. Since the region of integration is a rectangle of width 10/b and height 10/a, that will happen if c<norm([10/a,10/b]), which it is in this case.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1767279/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1767309/image.png)
Réponses (1)
Matt J
le 4 Sep 2024
Modifié(e) : Matt J
le 5 Sep 2024
As demonstrated in the comment above, the integral is theoretically non-convergent unless c>=norm([10/a,10/b]). Here is a further, numerical test:
a = 1;
b = 2;
c0 = norm([10/a,10/b]); %critical threshold
c=c0*1.0001; %slightly greater than threshold
k = @(x,y) 1./(sqrt(x.^2/a^2+y.^2/b^2)-c);
h = integral2(@(x,y) k(x,y) ,0,10,-10,10)
c=c0*0.9999;%slightly less than threshold
k = @(x,y) 1./(sqrt(x.^2/a^2+y.^2/b^2)-c);
h = integral2(@(x,y) k(x,y) ,0,10,-10,10)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differentiation 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!