Intergrating from negative infinity to infinity
조회 수: 16 (최근 30일)
이전 댓글 표시
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."
댓글 수: 0
채택된 답변
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)
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!