MATLAB: Incorrect function output in a 3D formula

3d plotsfunctionsmatlab function

When i enter the simple formula f(x,y)=X^2 * Y^3 as follows:
[X,Y] = meshgrid(-2:0.2:2); Z = (Y.^3) * (X.^2); surf(X,Y,Z)
Matlab's output is a graph that reaches a value >600 at (2.2) rather than 2^3 * 2^2 = 32. It seems to ignore the regular brackets. Why does this happen?

Best Answer

f=@(x,y) x.^2.*y.^3;
[X,Y] = meshgrid(-2:0.2:2,-2:0.2:2);
Z = f(X,Y)
surf(X,Y,Z)