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

조회 수: 7 (최근 30일)
Xin
Xin 2012년 10월 12일
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
Xin
Xin 2012년 10월 12일
it worked. thanks a lot for the answers and suggestions.

댓글을 달려면 로그인하십시오.

채택된 답변

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

추가 답변 (2개)

Ilham Hardy
Ilham Hardy 2012년 10월 12일
It is Matlab standard function, only available in R2012b.

Andreas Goser
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."

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by