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

1 visualización (últimos 30 días)
xosro
xosro el 21 de Jul. de 2017
Respondida: Steven Lord el 21 de Jul. de 2017
for example:
if true
integral(@(x)exp(-(x.^2)/2),-inf,-inf)
end

Respuesta aceptada

Richard Marveldoss
Richard Marveldoss el 21 de Jul. de 2017
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

Más respuestas (1)

Steven Lord
Steven Lord el 21 de Jul. de 2017
For computing that integral, you probably want to use the erf and/or erfc functions.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by