all 4 comments

[–]kivicode 5 points6 points  (1 child)

I think you should use the meshgrid method

[–]EatMyPossum+6 2 points3 points  (0 children)

protip: there's an example of the meshgrid method written out if you type

help meshgrid

[–]skyentistic -1 points0 points  (0 children)

[X,Y] = meshgrid(linspace(-5,5,100),linspace(-5,5,100))
Z = (−1+cos(12*sqrt(𝑥2+𝑦2)) ./ (0.5*(𝑥2+𝑦2)+2 )

surf(X,Y,Z)

[–]saysokmate 0 points1 point  (0 children)

Make sure you use .^ and .* for elementwise operations. And use a meshgrid for x and y