0
0
MATLABdata~10 mins

mesh and surf for surfaces in MATLAB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a grid of points using meshgrid.

MATLAB
x = -2:0.5:2;
y = -2:0.5:2;
[X, Y] = [1](x, y);
Drag options to blanks, or click blank then click option'
Ameshgrid
Bplot
Clinspace
Dsurf
Attempts:
3 left
💡 Hint
Common Mistakes
Using linspace instead of meshgrid.
Trying to use plot to create coordinate matrices.
2fill in blank
medium

Complete the code to calculate Z as the sum of squares of X and Y.

MATLAB
Z = [1].^2 + Y.^2;
Drag options to blanks, or click blank then click option'
AY
BX
CZ
Dx
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase x instead of matrix X.
Forgetting the dot before the power operator.
3fill in blank
hard

Fix the error in the code to plot the surface using surf.

MATLAB
surf(X, Y, [1]);
Drag options to blanks, or click blank then click option'
AZ
Bplot
CY
Dx
Attempts:
3 left
💡 Hint
Common Mistakes
Passing x or y instead of Z to surf.
Trying to use plot instead of surf.
4fill in blank
hard

Fill both blanks to create a mesh plot and label the axes.

MATLAB
mesh(X, Y, Z);
xlabel('[1]');
ylabel('[2]');
Drag options to blanks, or click blank then click option'
AX-axis
BY-axis
CZ-axis
DSurface
Attempts:
3 left
💡 Hint
Common Mistakes
Labeling axes incorrectly or swapping labels.
Using 'Z-axis' label for x or y axis.
5fill in blank
hard

Fill all three blanks to create a surface plot with title and color bar.

MATLAB
surf(X, Y, Z);
title('[1]');
colorbar;
shading [2];
view([3]);
Drag options to blanks, or click blank then click option'
A3D Surface Plot
Binterp
C[45 30]
Dflat
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'flat' shading which is less smooth.
Not setting a proper view angle for 3D visualization.