Numerical integration with triplequad and method quadgk

8 Ansichten (letzte 30 Tage)
Drew Mitchell
Drew Mitchell am 5 Mai 2016
Beantwortet: Star Strider am 5 Mai 2016
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

Antworten (1)

Star Strider
Star Strider am 5 Mai 2016
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.

Community Treasure Hunt

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

Start Hunting!

Translated by