Numerical integration with triplequad and method quadgk
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!