How to do Double numerical integration with a variable limits

조회 수: 10 (최근 30일)
Can someone please help me in doing numerical integration on the following function, I want to do double numerical integration with respect to y and x, such that the final answer will be a function of z only. Also the limit of integration is not a constant, it is basically something like (x-y, x+y), not sure if there exist a way to do this, can someone please advise me on how to proceed?
Thank you
  댓글 수: 10
Torsten
Torsten 2022년 9월 4일
The integral (once it is correctly written) could be considered as a function of z. Then numerical integration can be carried out.
Abdulaziz Al-Amodi
Abdulaziz Al-Amodi 2022년 9월 6일
편집: Abdulaziz Al-Amodi 2022년 9월 6일
z is always positive, I made a mistake when I wrote -inf, was just trying to understand the implementation of it.
I found 'vpaintegral' and it looks promising but it is very slow to compute.
Thank you for your help

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2022년 9월 6일
편집: Matt J 2022년 9월 6일
I'll demonstrate for a simpler function. The technique is the same regardless of what function we're integrating.
F=@(x,y,z) x.^2+y.^2+z.^2; %The input function to be integrated
Iyz=@(y,z)integral( vect(@(q)F(q,y,z)), z-y,z+y); %partial integral w.r.t. x
Iz=@(z) integral( vect(@(q)Iyz(q,z)) , 0,z); %partial integral w.r.t. y
Iz(1)
ans = 2.6667
function fun=vect(fun)
%vectorize a non-vectorized function
fun=@(x) arrayfun(fun,x);
end
  댓글 수: 6
Torsten
Torsten 2022년 9월 8일
편집: Torsten 2022년 9월 8일
Yes, the square root in the denominator is quite ambitious ... When it gives real values and when it is different from 0 ... To take care of it in the integration limits for x,y and z won't be easy - be it with or without Mathematica.
Abdulaziz Al-Amodi
Abdulaziz Al-Amodi 2022년 9월 8일
Right, I'll hopefully look more into it to figure it out.
Thanks again!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by