improper integral
이전 댓글 표시
Hi!!I need help in the calculation of the integral of the function below
function out = fun(u,a,b)
out = exp(-a.* exp(2.*u)).*exp(-(u + b.^2).^2./2.*b.^2)/...
(sqrt(2.*pi.*b.^2));
end
a=0; b=1; *quad('fun',-Inf,Inf,[],[],a,b);
Is there any idea? where is the mistake?
댓글 수: 3
Andrew Newell
2011년 4월 5일
What version of MATLAB are you using? The syntax you are using for QUAD is outdated.
Asatur Khurshudyan
2012년 12월 30일
I guess you have to calculate the principal value (by Cauchy) of that integral, otherwise you`ll have Nan`s or Infinity`s. I also have such a problem with 3D plotting improper integrals with infinite upper limit. Have anyone did something like that?
Roger Stafford
2012년 12월 30일
For a = 0 this becomes just the integral of a normal distribution density function over its full range, and of course it must then be equal to 1. It is when a is greater than zero that the integral becomes more interesting. For negative a the integral is divergent.
채택된 답변
추가 답변 (1개)
Matt Fig
2011년 4월 5일
quadgk(@(x) fun(x,0,1),-inf,inf) % 0 is a, 1 is b.
But for a = 0, b = 1, we encounter an infinite number or nan. Are these numbers correct? If so, you could try this:
quadgk(@(x) fun(x,0,1),-10,10) % Exponentially decreasing values.
Or look at QUADL.
quadl(@(x) fun(x,0,1),-200,200,1e-15)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!