Intergrating from negative infinity to infinity

9 ビュー (過去 30 日間)
Supreeth D K
Supreeth D K 2022 年 5 月 9 日
回答済み: Chunru 2022 年 5 月 9 日
Hello,
I am trying to solve an equation where limits of intergration are from negative infinity to infinity.
function damp = pmb(zeta)
syms zeta
mu=4*pi*10.^-7;i=1;v=10;w=0.001;%t=0.05; r=0.032;
sigma= 5.8*10.^7; a=mu*sigma; h=0.05;p=0.01; lp=0.1;
k=sqrt(((zeta).^2)+(i*zeta*a*v));
H=(((zeta).^2)./(((zeta).^2)+(k.^2)+(2*abs(zeta)*k*coth(k*w))));
x1=exp(-(abs(zeta))*p); x2=exp(-(abs(zeta))*h);
n=3;
for I=1:n
e1=exp(i*zeta*(1+lp)); e2=exp(i*zeta*1);
jr=(1./(4*pi*((zeta).^2))).*(e1-e2)*(-i).^(n-1);
end
A=jr*mu*(1-x1)*x2;
z=(abs(zeta*A)).^2;
S= z*real(H);
end
i get the following error, while using quad function damp=quad('pmb',-inf,inf)
"The integrand function must return an output vector of the same length as the input vector."

採用された回答

Chunru
Chunru 2022 年 5 月 9 日
The following correct the syntax error in your original program. You need to check/debug the function definition to ensure it is integratable.
y=integral(@pmb,-inf,inf)
Warning: Inf or NaN value encountered.
y = Inf
function S = pmb(zeta)
%syms zeta
mu=4*pi*10.^-7; i=1;v=10; w=0.001;%t=0.05; r=0.032;
sigma= 5.8*10.^7; a=mu*sigma; h=0.05; p=0.01; lp=0.1;
k=sqrt(((zeta).^2)+(i*zeta*a*v));
H=(((zeta).^2)./(((zeta).^2)+(k.^2)+(2*abs(zeta).*k.*coth(k*w))));
x1=exp(-(abs(zeta))*p); x2=exp(-(abs(zeta))*h);
n=3;
for I=1:n
e1=exp(i*zeta*(1+lp)); e2=exp(i*zeta*1);
%whos
jr=(1./(4*pi*((zeta).^2))).*(e1-e2)*(-i).^(n-1);
end
A=mu*jr.*(1-x1).*x2;
z=(abs(zeta.*A)).^2;
S= z.*real(H);
%whos
%pause
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by