フィルターのクリア

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 Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by