Double Integration Matlab

Hello

I've been trying to write an m file that can carry out double integration and plot it in 3d form, obviously I am stuck otherwise I wouldn't be posting here:

$\displaystyle (x^2y - 2xy + xy^2)dxdy$

The outer integral limits are 0 and 3, and the inner limits are 1 and 2.

So far I have this:

[FONT=Courier New] Quote:

Originally Posted by **matlab**

[% Function f(x) is defined by

f(x,y)=x.^2*y-2*x*y+x*y.^2;

% We are integrating this with respect to x and y

% Using the Internd funcition to evaluate this integral

f(x,y) = integrnd(x,y);

f(x,y) = x.^2*y -2*x*y +x*y.^2;

% xmin is the Lower Limit of Inner Integral

% xmax is the Upper Limit of Inner Integral

% ymin is the Lower Limit of Outer Integral

% ymax is the Upper Limit of Outer Integral

xmin = 1;

xmax = 2;

ymin = 0;

ymax = 3;

f(x,y) = dblquad(@integrnd,xmin,xmax,ymin,ymax);

% This is integrating the function with respect to x and y

% To plot in 3d, we must use the plot3d command

plot3(x,y,z)

grid on

title('f(x,y) represented in 3D view')

xlabel('x = cos(a)')

ylabel('y = sin(a)')

zlabel('z = a')

I am unsure as what to put in as x and y at the end, and also with the z=a ..

Any help is appreciated