Hi! Thanks for providing extra details! Below are the steps I used with explanations for each. I also labeled them in accordance with the steps in the instructions you provided.
close all; clear all; clc;
gridspacing = -8: 0.5: 8;
R=sqrt(X.^2 + Y.^2);
In the instructions you provided, it says that R=X^2 + Y^2. If you use this equation, you get a plot that does not match the figure you have provided. If you use the R equation in the instructions, you do get the right answers. Additionally, it says to treat X and Y like vectors. I think by this they're hinting that you should use element-wise powers (.^ rather than ^) on the matrices, not use vectors for x and y.
The default colormap is going to be perula, while it looks like the colormap for the example figure you show is jet. You can easily change this with one line of code after you use the mesh function:
Hope this helps!