Facing problem with Double integral of function P=f(u,v) for -∞<u<∞ and -∞<v<∞ & y=0:5:90;

5 ビュー (過去 30 日間)
Dharmendra
Dharmendra 2012 年 9 月 13 日
I have been facing problem to integrate P=f(u,v) for -∞<u<∞ and -∞<v<∞ where y varies 0 to 90. i want to have a table of y Vs. Q from below function.
%%Double integral of function P=f(u,v) for -∞<u<∞ and -∞<v<∞ & y=0:5:90;
clear all;
clc;
k=112.0501;
x=4.0-0.01*1i; % Dielectric constant of surface
y=0:5:90;
H=(cosd(y)-sqrt(x-sind(y).^2))./(cosd(y)+sqrt(x-sind(y).^2));
V=(x.*cosd(y)-sqrt(x-sind(y).^2))./(x.*cosd(y)+sqrt(x-sind(y).^2));
R=(V-H)/2;
f1 = @(u,v)(8.*R.^2./(sqrt(k.^2-u.^2-v.^2)));
f2 = @(u,v)(-2+6.*R+((1+R).^2./er)+er.*(1-R).^2)./(sqrt(er.*k.^2-u.^2-v.^2));
f3 = @(u,v)(u.*v./cosd(y));
F = @(u,v)(f3(u,v).*(f1(u,v)+f2(u,v)));
P= @(u,v)(abs(F(u,v)).^2+F(u,v).*conj(F(u,v)));
Q = quad2d(P,0,1,0,1)
table=[theta Q];
  2 件のコメント
Matt Fig
Matt Fig 2012 年 9 月 13 日
What is er?
Dharmendra
Dharmendra 2012 年 9 月 14 日
編集済み: Matt Fig 2012 年 9 月 14 日
Thanks a lot Matt for your time. I am sorry for some mistakes.Now i am putting whole function. please help
%%Double integral of function P=f(u,v) for -∞<u<∞ and -∞<v<∞ & y=0:5:90;
clear all;
clc; k=112.0501;
x=4.0-0.01*1i;
y=0:5:90;
H=(cosd(y)-sqrt(x-sind(y).^2))./(cosd(y)+sqrt(x-sind(y).^2));
V=(x.*cosd(y)-sqrt(x-sind(y).^2))./(x.*cosd(y)+sqrt(x-sind(y).^2));
R=(V-H)/2; f1 = @(u,v)(8.*R.^2./(sqrt(k.^2-u.^2-v.^2)));
f2 = @(u,v)(-2+6.*R+((1+R).^2./x)+x.*(1-R).^2)./(sqrt(x.*k.^2-u.^2-v.^2));
f3 = @(u,v)(u.*v./cosd(y)); F = @(u,v)(f3(u,v).*(f1(u,v)+f2(u,v)));
P= @(u,v)(abs(F(u,v)).^2+F(u,v).*conj(F(u,v)));
Q = quad2d(P,0,1,0,1)
table=[theta Q];

サインインしてコメントする。

採用された回答

Mike Hosea
Mike Hosea 2012 年 9 月 13 日
編集済み: Mike Hosea 2012 年 9 月 13 日
QUAD2D requires an integrand function f(x,y) that operates element-wise on input matrices. So f([1,2;3,4],[5,6;7,8]) must evaluate to [f(1,5),f(2,6);f(3,7),f(4,8)]. Your integrand function involves an array of y values. QUAD2D does not support creating an array of Q values, so to make a table you will need to loop over each y value and compute each corresponding Q value and store that in an array.
Note that the new INTEGRAL2 function in R2012a supports improper integrals.
  2 件のコメント
Dharmendra
Dharmendra 2012 年 9 月 14 日
Thanks a lot for your time Mike.I also want to do it for -inf to +inf.can you give some idea because it is showing problem.
Mike Hosea
Mike Hosea 2012 年 9 月 15 日
k=112.0501;
x=4.0-0.01*1i;
y=0:5:85;
n = length(y);
Q = zeros(n,1);
for i = 1:n
H=(cosd(y(i))-sqrt(x-sind(y(i)).^2))./(cosd(y(i))+sqrt(x-sind(y(i)).^2));
V=(x.*cosd(y(i))-sqrt(x-sind(y(i)).^2))./(x.*cosd(y(i))+sqrt(x-sind(y(i)).^2));
R=(V-H)/2; f1 = @(u,v)(8.*R.^2./(sqrt(k.^2-u.^2-v.^2)));
f2 = @(u,v)(-2+6.*R+((1+R).^2./x)+x.*(1-R).^2)./(sqrt(x.*k.^2-u.^2-v.^2));
f3 = @(u,v)(u.*v./cosd(y(i))); F = @(u,v)(f3(u,v).*(f1(u,v)+f2(u,v)));
P= @(u,v)(abs(F(u,v)).^2+F(u,v).*conj(F(u,v)));
Q(i) = quad2d(P,0,1,0,1);
end
table=[y' Q];
Note that you cannot use y = 90 because f3(u,v) = u.*v./cosd(y). The denominator there would be zero. I do not know what integrals you intend to evaluate from -inf to inf because the integral of P does not converge (mathematically). However, in principle, the QUAD2D line would instead be
Q(i) = integral2(P,-inf,inf,-inf,inf);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by