MATLAB: Produce an eggbox

eggbox

Dear all, I should produce an eggbox. I tried to use this code, following the instructions, but I did not receive what I needed. Where's the error?
x=[-10:0.2469135802469136:+10]
y=[-10:0.2469135802469136:+10]
[X,Y]= meshgrid(x,y)
M1=sin(X)
M2=sin(Y)
M12=M1*M2
surf(X,Y)
X.^2
Thanks a lot

Best Answer

The hint explicitly said element-by-element multiplication which is accomplished via
M12 = M1.*M2 % note the use of .*
Related Question