Discontinuities when computing integration of error functions using integral function
이전 댓글 표시
I am trying to integrate a function over a region in different time intervals. The integration looks something like this.
fun_uz = @(u)1./sqrt(u).*exp(-Z.^2./(2.*u));
fun_Y = @(u)(erf((Y+B)./sqrt(2.*u))-erf((Y-B)./sqrt(2.*u)));
fun_Z = @(u)(erf((X+L+u)./sqrt(2.*u))-erf((X-L+u)./sqrt(2.*u)));
fun = @(u)inc.*fun_uz(u).*fun_Y(u).*fun_Z(u);
fint = integral(fun,0,upperl);
The variable 'upperl' is the upper limit of the integral function. I have to perform this integration over different X,Y, and Z regions and different 'upperl' values. I am getting profiles which are discontinuous for different 'upperl' values. I have shown here profiles at few different 'upperl' values.

I am not able to understand why the discontinuity are occuring, any help is greatly appreciated. Thanks.
댓글 수: 6
darova
2020년 3월 19일
Attach the whole code
Yaswanth Sai
2020년 3월 19일
편집: Yaswanth Sai
2020년 3월 20일
darova
2020년 3월 19일
I changed line
xs = (-10:1:10)./1000;
Looks ok

Yaswanth Sai
2020년 3월 19일
편집: Yaswanth Sai
2020년 3월 19일
darova
2020년 3월 19일
time = 1e-2; % The variable which is changed to generate different contour plots
xs = (-500:10:10)./1000;

Yaswanth Sai
2020년 3월 19일
채택된 답변
추가 답변 (1개)
Walter Roberson
2020년 3월 20일
Change the integral to
fint = integral(fun,0,upperl, 'waypoints', L-X);
You have two erf that only have an input near 0 (and so a measurable output) near-ish -(X+L) to -(X-L) . Some of your integral() calls just happened to evaluate near there, and some of them did not happen to evaluate near there and predicted that there was nothing interesting in that area. The above forces evaluation near that area.
댓글 수: 1
Yaswanth Sai
2020년 3월 20일
편집: Yaswanth Sai
2020년 3월 20일
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

