This enhancement has been incorporated in Release 2012a (R2012a). For previous product releases, read below for any possible workarounds:
To use the function DBLQUAD with the method QUADGK, a wrapper function needs to be used. This is because the calling sequence is different for the function QUADGK than what is passed from the function DBLQUAD.
The wrapper code would look like:
myquad = @(fun,a,b,tol,trace,varargin)quadgk(@(x)fun(x,varargin{:}),a,b,'AbsTol',tol);
a = dblquad(@(x,y)obj_fun(x,y),-inf,inf,-inf,inf,1e-5,myquad);
As a side note, using INF as function limits introduces a singularity at the end points. The example objective function also has discontinuities in the objective function that are not efficient for the integration.
It is recommended that, if possible, specify finite limits for the integration and break the interval into smaller parts, integrate each continuous part using the method QUAD2D and then add the results up.
The attached MATLAB-file demonstrates how to accomplish the above for the given objective function.
Best Answer