why i receive Nan for integral -inf to -inf ?

조회 수: 1 (최근 30일)
xosro
xosro 2017년 7월 21일
답변: Steven Lord 2017년 7월 21일
for example:
if true
integral(@(x)exp(-(x.^2)/2),-inf,-inf)
end

채택된 답변

Richard Marveldoss
Richard Marveldoss 2017년 7월 21일
The integral from -inf to -inf over exp(-(x.^2)/2) is the same as calculating the area of the rectangle bounded by -inf and -inf with a height e(-(x.^2)/2) evaluated at -inf(which is 0).The difference between -infs will return an NaN in MATLAB . The NaN times the height(0) results in NaN as well. The documentation link for properties of NaN : https://www.mathworks.com/help/matlab/ref/nan.html

추가 답변 (1개)

Steven Lord
Steven Lord 2017년 7월 21일
For computing that integral, you probably want to use the erf and/or erfc functions.

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by