필터 지우기
필터 지우기

Numerical integration with triplequad and method quadgk

조회 수: 8 (최근 30일)
Drew Mitchell
Drew Mitchell 2016년 5월 5일
답변: Star Strider 2016년 5월 5일
I am wondering how to use quadgk as my method for integration using triplequad. In the help for triplequad it says that quadgk is not directly supported but can be implemented if I 'write my own function' and I am wondering how to do this.
Thanks
Drew

답변 (1개)

Star Strider
Star Strider 2016년 5월 5일
The documentation says that it’s possible, but regardless of the several ways I’ve tried to make it work, I can’t. (The triplequad function is on its way out, being replaced since R2013a with integral3.) I submitted a Service Request detailing my attempts to make this work, telling MathWorks to contact you as well, and I included the URL to this thread.
The code I used (although I also tried several other methods):
intfcn = @quadgk;
fun = @(x,y,z) exp(x) .* sin(y) .* cos(z); % Function To Integrate
[xmin,xmax,ymin,ymax,zmin,zmax] = deal(0, 1, 0, pi/2, 0, pi/2); % Shortcut
q = triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax,1E-6,intfcn)
It works without the last argument, but not with it. The problem seems to be the way triplequad calls quadgk, the reason I submitted my Service Request. The documentation for triplequad does not give any examples using the last argument, so we have no guidance.
This isn’t really an Answer, but it’s the best I can do.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by