%% Evaluate Double Integral
% Integrate
% y \sin(x) + x \cos(y)
% over -\pi \le x \le 2 \pi and 0 \le y \le \pi.

fun = @(x,y) y.*sin(x)+x.*cos(y);
Q = quad2d(fun,pi,2*pi,0,pi)

%
% Compare the result to the true value of the integral, -\pi^2.

-pi^2

% Copyright 2012 The MathWorks, Inc.