Warning: Non-finite result. The integration was unsuccessful. Singularity likely. > In integral2Calc>integral2t (line 131)

69 vues (au cours des 30 derniers jours)
Hi
i run the function
[Is]=currentMoM()
f = 300000000
N = 39
ra = 1
k0 = 6.2832
Z0 = 376.9911
lambda = 1
reason_for_failure = NaN + NaNi
Warning: Non-finite result. The integration was unsuccessful. Singularity likely.
Unrecognized function or variable 'Efieldin'.

Error in solution>@(x)triangle_basisn(x,index_i).*(4./(Z0.*k0)).*Efieldin(x) (line 36)
fun=@(x)triangle_basisn(x,index_i).*(4./(Z0.*k0)).*Efieldin(x);

Error in integralCalc>iterateScalarValued (line 334)
fx = FUN(t);

Error in integralCalc>vadapt (line 148)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, ...

Error in integralCalc (line 77)
[q,errbnd] = vadapt(vfunAB,interval, ...

Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);

Error in solution>currentMoM (line 37)
gm(index_i) =integral(fun,Phi0(index_i),Phi0(index_i)+2*pi./(N-1));
function [Is]=currentMoM()
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
[f,N,ra,k0,Z0,lambda] = parameter()
gamma_const=1.781;
Phi0=zeros(N);
e=exp(1);
dftm=2.*pi./(N-1);
for jj = 1:N+1
Phi0(jj)=(jj-1).*dftm;
end
% delta_c(i) = sqrt((pos(i,1) - pos(i+1,1))^2 + (pos(i,2) - pos(i+1,2))^2);
lmn = zeros(N);
%zmn = zeros(N);
gm = zeros(1,N);
zmn = zeros(N);
%vim = zeros(1,N);
%vsn = zeros(1,N);
coeif=(Z0.*k0./4).*ra.*dftm;
coeifn=(Z0./2).*sin(k0.*ra.*dftm./2);
for index_i = 1:N
for index_j = 1:N
if index_i == index_j
fun = @(x,y)triangle_basisn(x,index_i).*triangle_basisn(y,index_j).*ra.*(1-j.*(2/pi).*log(gamma_const.*k0.*ra*sqrt(2-2*cos(x-y))./2));
reason_for_failure = fun(Phi0(index_i),Phi0(index_j))
lmn(index_i,index_j) =integral2(fun, Phi0(index_i),Phi0(index_i)+2*pi./(N-1),Phi0(index_j),Phi0(index_j)+2*pi./(N-1));
else
fun = @(x,y)triangle_basisn(x,index_i).*triangle_basisn(y,index_j).*ra.^2.*besselh(0,2,k0.*ra*sqrt(2-2*cos(x-y)));
lmn(index_i,index_j) =integral2(fun,Phi0(index_i),Phi0(index_i)+2*pi./(N-1),Phi0(index_j),Phi0(index_j)+2*pi./(N-1));
zmn(index_i,index_j) = lmn(index_i,index_j);
fun=@(x)triangle_basisn(x,index_i).*(4./(Z0.*k0)).*Efieldin(x);
gm(index_i) =integral(fun,Phi0(index_i),Phi0(index_i)+2*pi./(N-1));
end
%vim(index_i) = delta_c(index_i) * exp(j*k0*(xm(index_i)*cos(phi_i)+ym(index_i)*sin(phi_i)));
%vsn(index_i) = delta_c(index_i) * exp(j*k0*(xm(index_i)*cos(phi_s)+ym(index_i)*sin(phi_s)));
end
W = linsolve(zmn,gm');
for ii=1:N
Is(ii)=W(ii);
end
y= Is
end
end
i use the integral2 and i recieve the message Warning: Non-finite result. The integration was unsuccessful. Singularity likely.
> In integral2Calc>integral2t (line 131)
what happen?
also i use the following function
function z=triangle_basisn(phi,kk)
[f,N,ra,k0,Z0,lambda] = parameter();
dftm=2.*pi./(N-1);
for jj = 1:N+1
Phi0(jj)=(jj-1).*dftm;
end
Phin=Phi0;
if kk==1
z=phi./dftm;
elseif ( phi >= Phin(kk-1) ) & ( phi <=Phin(kk));
z=(phi-Phin(kk-1))./dftm;
elseif (phi >= Phin(kk) ) & (phi <=Phin(kk+1));
z=(Phin(kk+1)-phi)./dftm;
end
end
function [f,N,ra,k0,Z0,lambda] = parameter()
%UNTITLED Summary of this function goes here
c0=3e8;
Z0=120.*pi;
ra=1;
N=39;
f=300e6;
lambda=c0./f;
k0=2*pi./lambda;
end
tnak you

Réponses (1)

Torsten
Torsten le 25 Nov 2024 à 19:46
fun(Phi0(1),Phi0(1))
gives
NaN + 1i*NaN
  11 commentaires
Torsten
Torsten le 26 Nov 2024 à 10:44
Modifié(e) : Torsten le 26 Nov 2024 à 10:45
sorrry i receive the same message
Output argument "z" (and possibly others) not assigned a value in the execution with "triangle_basisn"
function.
Did you read @Walter Roberson 's and my comment ? Negative values of the independent variable phi are not covered in your if-statement, and thus no value is assigned to z:
if kk==1
z=phi./dftm;
elseif ( phi >= Phin(kk-1) ) & ( phi <=Phin(kk));
z=(phi-Phin(kk-1))./dftm;
elseif (phi >= Phin(kk) ) & (phi <=Phin(kk+1));
z=(Phin(kk+1)-phi)./dftm;
end
george veropoulos
george veropoulos le 26 Nov 2024 à 12:04
Yes!! this is the problem sorry i see the comment later

Connectez-vous pour commenter.

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by