Minimums step size reached, while integrating.

조회 수: 5 (최근 30일)
Jay
Jay 2017년 9월 21일
답변: Walter Roberson 2017년 9월 21일
Hello everyone, so I ran this piece of code and I got multiple warnings on reaching the minimum step size. I get a very dubious output. So i tried changing the sample size, but irrespective of me increasing or decreasing, I get the same warnings and get the same unsure output.
Here is the code I'm running -
f=15e8:(20e9-10e8)/100:16e9;
s=length(f);
epso = 8.8 *10.^-12;
epsr=5.7;
ro=3.63*(10.^-3);
epsl = 2.5;
ri=1.13*(10.^-3);
copen = (epso/sqrt(epsr)*log(ro/ri));
cload= (epsl/sqrt(epsr)*log(ro/ri));
t = zeros(1,s);
for i = 1:length(f)
fun = @(x)((((((besselj(0,(2*pi*f(i))/(3e8))*x*ro)-besselj(0,(2*pi*f(i))/(3e8))*x*ri)).^2)./x).*freload(x,f(i)));
y(i) = copen*abs(integral(fun,0,Inf,'arrayvalued',true));
t(i)=(1-y(i))/(1+y(i));
end
plot(f,abs(t));
The function called is as follows -
function f = freload(x,q)
epsl=3.4-0.004j;
f=(1./sqrt(epsl-(x.^2))).*(1+exp(-2*1i*2*pi*q/(3e8).*sqrt(epsl-(x.^2))))./((1-exp(-2*1i*2*pi*q/(3e8).*sqrt(epsl-(x.^2)))));
end
The full warning I get is as follows -
Warning: Minimum step size reached near x = 1.75484e+22. There may be a singularity, or the tolerances
may be too tight for this problem.
> In integralCalc/checkSpacing (line 456)
In integralCalc/iterateScalarValued (line 319)
In integralCalc/vadapt (line 132)
In integralCalc (line 83)
In integral (line 88)
In trial (line 14)
And the number of times I get this depends on the number of samples taken. Does anyone know why this problem occurs, or how I could go about overcoming this ? Any help or suggestion would be greatly appreciated.
Thanks.
  댓글 수: 1
Jay
Jay 2017년 9월 21일
I tried executing the integral outside the for loop only for one value of f, and while I get an output is returned I still get the same warning, that a minimum step size is reached near a certain value for x. Moreover this value for x does not change for different values of f. So, could this be a problem while integrating the bessel function ? It reaches the minimum step size at 1.75e+22. Could it be a problem of using large numbers ?

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

답변 (1개)

Walter Roberson
Walter Roberson 2017년 9월 21일
On your first iteration, i = 1, if you switch to the symbolic toolbox
syms x
g = fun(x)
then limit(imag(g), x, inf) is non-zero . Therefore if the imaginary component is convergent it is infinite anyhow, so the solution for the integral is going to have to be either non-convergent or a complex number involving infinity.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by