which packages do I need to use 'integral' function?

which packages do I need to use 'integral' function? I type it on command line in 2011b and get an "Undefined function" error
>> fun = @(x) exp(-x.^2).*log(x).^2;
>> q = integral(fun,0,Inf)
Undefined function 'integral' for input arguments of type 'function_handle'.

1 comentario

Xin
Xin el 12 de Oct. de 2012
it worked. thanks a lot for the answers and suggestions.

Iniciar sesión para comentar.

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 12 de Oct. de 2012
use function quadgk
eg
>> fun = @(x) exp(-x.^2).*log(x).^2;
>> quadgk(fun,0,inf)
ans =
1.9475

Más respuestas (2)

Ilham Hardy
Ilham Hardy el 12 de Oct. de 2012

0 votos

It is Matlab standard function, only available in R2012b.
Andreas Goser
Andreas Goser el 12 de Oct. de 2012

0 votos

This was introduced in R2012a:
"The new functions, integral, integral2, and integral3 perform numerical integration with additional support for nonrectangular and unbounded regions of integration. They are the recommended functions for performing quadrature."

Categorías

Preguntada:

Xin
el 12 de Oct. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by