which packages do I need to use 'integral' function?
7 次查看(过去 30 天)
显示 更早的评论
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'.
采纳的回答
Andrei Bobrov
2012-10-12
use function quadgk
eg
>> fun = @(x) exp(-x.^2).*log(x).^2;
>> quadgk(fun,0,inf)
ans =
1.9475
0 个评论
更多回答(2 个)
Andreas Goser
2012-10-12
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."
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!