PDA

View Full Version : MATLAB - Reached the maximum number of function evaluations


strokebow
Oct19-11, 04:13 AM
Hi peoples,

Anyone know or have any ideas how we can better write this code to eliminate this quad2d warning???

num((i+1),(j+1)) = quad2d(@(x,y)inf_func(x,y,i,j),-pi,pi,-pi,pi);


The function code is:
function [y] = inf_func(x,y,m,n)
y = ((1-cos(m.*x+n.*y))./(1-(1/6)*(4*cos(x).*cos(y)+2*cos(2.*y))));
end

The warning given is:

> In quad2d at 242
Warning: Reached the maximum number of function evaluations (2000). The result
fails the global error test.

Any help is much appreciated!! Thanks