Calculating double integral of two variable
18 ビュー (過去 30 日間)
古いコメントを表示
I am having some issues calculation a double integral with two variable. my function F= {{sinc^2(X)sinc^2(Y)} *{sin^2(phi)+cos^2(theta)cos^2(phi)}}(sin(theta)).
I define X=(pi/2).*sin(theta).*cos(phi) and Y=(pi/2).*sin(theta).*sin(phi); and theta=[0 pi/2]; phi=[0 2*pi].
So, I have started
syms X Y theta phi
theta=linspace(0,pi/2);
phi=linspace(0,2*pi);
X=(pi/2).*sin(theta).*cos(phi);
Y=(pi/2).*sin(theta).*sin(phi);
func1=(sinc(X/pi).*sinc(Y/pi)).^2;
func2={(sin(theta))^2}+{cos(theta)cos(phi)}^2;
func=func1*func2;
func3=sin(theta);
Function1=vpa(int(func,0,2*pi),5)*vpa(int(func3,0,pi/2),5)
But I have also tried to rewrite
syms X Y theta phi
X=(pi/2).*sin(theta).*cos(phi);
Y=(pi/2).*sin(theta).*sin(phi);
Function1=@(theta,phi) ((sinc(X/pi).*sinc(Y/pi))^2 *((sin(phi))^2+(cos(theta)*cos(phi))^2))*(sin(theta));
E=integral2(Function1,0,pi/2,0,2*pi)
0 件のコメント
回答 (1 件)
Devineni Aslesha
2020 年 6 月 22 日
編集済み: Devineni Aslesha
2020 年 6 月 22 日
Hi Ismael,
To calculate the double integral of a two variable function, integral2 accepts only numeric variables. So, the entire function with two variable is defined as a single inline executable expression (anonymous function handles) as shown below.
Function1 = @(theta,phi) (((sinc((pi/2).*sin(theta).*cos(phi)).*sinc((pi/2).*sin(theta).*sin(phi))).^2).*((sin(phi)).^2+(cos(theta).*cos(phi)).^2)).*(sin(theta));
E = integral2(Function1,0,pi/2,0,2*pi)
For more information, refer the following link
2 件のコメント
madhan ravi
2020 年 6 月 22 日
The first statement contradicts the fact that int(...) with two calls exist if there’s an explicit solution.
Devineni Aslesha
2020 年 6 月 22 日
編集済み: Devineni Aslesha
2020 年 6 月 22 日
int can accept both numeric and symbolic variables, whereas integral2 accepts only numeric variables as integral2 solves the integral numerically. Also, thanks for pointing that out, I can edit the answer specific to integral2.
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!