Intergrating from negative infinity to infinity

3 views (last 30 days)
Supreeth D K
Supreeth D K on 9 May 2022
Answered: Chunru on 9 May 2022
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."

Accepted Answer

Chunru
Chunru on 9 May 2022
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by