필터 지우기
필터 지우기

Evaluating a complicated integral in Matlab gives NaN

조회 수: 2 (최근 30일)
MaxFrost
MaxFrost 2020년 2월 6일
댓글: MaxFrost 2020년 2월 7일
I wish to plot the values of the following integral as a function of ψ.
where, and
Following is my code:
Nu = 4; % Group cardinality
Pt = 10^(-12); % Effective transmission power
fc = 3*10^9; % Carrier frequency
df = 10^4; % Sub-carrier spacing
c = 3*10^8; % Speed of light
dv = 0.01;
Vmax = 0:dv:100-dv; % Maximum velocity of UEs
b = pi*Vmax*fc/c/df;
f2 = zeros(1, length(b));
f0 = @(t) sin(t)/t; % Defining Si(z) function
for i = 1:length(b)
f1 = @(psi) integral(f0, 0, 2*b(i)*cos(psi), 'ArrayValued', true)./b(i)./cos(psi) - (sin(b(i)*cos(psi))).^2./b(i)^2./(cos(psi)).^2;
f2(i) = integral(f1, 0, pi/2, 'ArrayValued', true);
P_ICI = Nu*Pt - (2/pi)*Nu*Pt*f2;
end
I use the integral function of MATLAB to compute the integral but it gives me the following error.
Warning: Infinite or Not-a-Number value encountered.
In integralCalc/midpArea (line 397)
In integralCalc (line 65)
In integral (line 88)
In @(psi)integral(f0,0,2*b(i)*cos(psi),'ArrayValued',true)./b(i)./cos(psi)-(sin(b(i)*cos(psi))).^2./b(i)^2./(cos(psi)).^2
In integralCalc/iterateArrayValued (line 193)
In integralCalc/vadapt (line 130)
In integralCalc (line 75)
In integral (line 88)
In CA_1 (line 13)
Can anyone suggest a way to get around this? Or point out what is wrong? Many thanks!
  댓글 수: 2
darova
darova 2020년 2월 6일
Try small number instead of 0
MaxFrost
MaxFrost 2020년 2월 7일
Thanks! I got it.

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2020년 2월 6일
편집: Matt J 2020년 2월 6일
Your integrand has a singularity at psi = pi/2. So perhaps try,
f2(i) = integral(f1, 0, pi/2*(1-eps), 'ArrayValued', true);

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by