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

2 ビュー (過去 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 Center および File ExchangeTime Series についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by