Intergrating from negative infinity to infinity

조회 수: 16 (최근 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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by