Complete the code to create a grid of points using meshgrid.
x = -2:0.5:2; y = -2:0.5:2; [X, Y] = [1](x, y);
The meshgrid function creates matrices for X and Y coordinates from vectors x and y, which is needed for 3D surface plotting.
Complete the code to calculate Z as the sum of squares of X and Y.
Z = [1].^2 + Y.^2;
We use X squared plus Y squared to get the surface height Z.
Fix the error in the code to plot the surface using surf.
surf(X, Y, [1]);The surf function needs the Z matrix for heights, so we pass Z.
Fill both blanks to create a mesh plot and label the axes.
mesh(X, Y, Z); xlabel('[1]'); ylabel('[2]');
We label the x-axis as 'X-axis' and the y-axis as 'Y-axis' to describe the plot clearly.
Fill all three blanks to create a surface plot with title and color bar.
surf(X, Y, Z); title('[1]'); colorbar; shading [2]; view([3]);
The title describes the plot, 'interp' smooths colors, and view sets the angle to [45 30].
