Warning: Non-finite result. The integration was unsuccessful. Singularity likely. > In integral2Calc>integral2t (line 131)
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
Hi  
i  run  the   function 
[Is]=currentMoM()
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
0 个评论
回答(1 个)
  Torsten
      
      
 2024-11-25
        fun(Phi0(1),Phi0(1))
 gives 
NaN + 1i*NaN
11 个评论
  Torsten
      
      
 2024-11-26
				
      编辑:Torsten
      
      
 2024-11-26
  
			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
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


