I need help with a Triple Integral

Im trying to do the next integral
With this code
fun = @(x,y,z) r
zmin = sqrt(2-(r^.2)/20)+12
zmax = 17.5-((r^.2)/3)
xmin = 0
xmax = 2*pi;
rmin = 0
rmax = 3.60767
result = integral3(fun,zmin,zmax,xmin,xmax,rmin,rmax);

댓글 수: 2

Francisco Ramirez
Francisco Ramirez 2019년 10월 30일
And for some reason it just went off, anyways, ive tried using integral3, stright up doing Int 3 times but nothing seems to work, any help?
What about arguments here?
zmin = sqrt(2-(r^.2)/20)+12 % @(r) sqrt ...
zmax = 17.5-((r^.2)/3)
Also you are writing here that arguments are (x,y,z) but function contains r
fun = @(x,y,z) r

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

답변 (3개)

Asvin Kumar
Asvin Kumar 2019년 11월 1일

1 개 추천

Try using the following code:
fun = @(x,y,z) y; % y is r
zmin = @(u,v) sqrt(2-(v.^2)/20)+12; % z
zmax = @(u,v) 17.5-((v.^2)/3);
xmin = 0; % theta
xmax = 2*pi;
ymin = 0; % r
ymax = 3.60767;
result = integral3(fun,xmin,xmax,ymin,ymax,zmin,zmax)
This code rearranges the order of integration. This is done to support the order of computation of limits in integral3 keeping in mind dependency among variables. The limits of integration of ’z’ are dependent on values of ‘r’ while the limits of integration of ‘r’ and ‘theta’ are independent.
The documentation at https://www.mathworks.com/help/matlab/ref/integral3.html#btbbw_k-1-fun explains how the limits are computed. The limits ymin and ymax are computed using x, which is ‘theta’ in this case, and the limits zmin and zmax are computed using x, y, which are ‘theta’ and ‘r’ in this case.
That is why the code given above passes arguments in the order: ‘theta’ , ‘r’ , ‘z’. Note also that the code can be modified to pass the arguments such that ‘r’ comes first followed by ‘z' and then ‘theta’. ‘fun’ would then need to be appropriately modified but that approach could also produce the desired output.
Additionally, refer to the example at https://www.mathworks.com/help/matlab/ref/integral3.html#btdgkz_ for better understanding.
There exists an alternate approach to compute the triple integral. It uses the Symbolic Math Toolbox. Code attached below for reference:
syms z x r
tmp = int(r,z,sqrt(2-(r.^2)/20)+12,17.5-((r.^2)/3));
tmp = int(tmp,x,0,2*pi);
tmp = int(tmp,r,0,3.60767);
val = vpa(tmp)
Ajay R
Ajay R 2022년 2월 21일

0 개 추천

Syms x, y, z int(int(int(1,z,[0,sqrt(a²-x²-y²)]),y,[0,sqrt(a²-x²)]),x,[0,a])
David Goodmanson
David Goodmanson 2022년 2월 21일

0 개 추천

Hi Francisco.
this is really just a 1d integral. Since nothing depends on theta, the theta integration instantly gives an overall factor of 2pi. Since nothing depends on z, the z integration just gives the value at the upper limit minus the value at the lower limit, or
17.5-((r.^2)/3) - (sqrt(2-(r.^2)/20)+12)
There is an extra factor of r in the integrand, so all this reduces to
f = @(r) ( 17.5-((r.^2)/3) - (sqrt(2-(r.^2)/20)+12) ).*r
I = 2*pi*integral(f,0,3.60767)
I = 83.3625

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2019년 10월 30일

답변:

2022년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by