Challenge - 5 Problems
3D Plot Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of 3D plot matrix multiplication
What is the output of the following MATLAB code snippet that creates a 3D surface plot of a matrix multiplication result?
MATLAB
A = [1 2; 3 4]; B = [2 0; 1 3]; C = A * B; surf(C);
Attempts:
2 left
💡 Hint
Recall how matrix multiplication works: multiply rows of A by columns of B.
✗ Incorrect
Matrix multiplication of A and B results in [[4 6]; [10 12]]. The surf function plots these values in 3D, showing height as the matrix values.
🧠 Conceptual
intermediate1:30remaining
Why 3D plots reveal complex relationships
Why do 3D plots help us see complex relationships between variables better than 2D plots?
Attempts:
2 left
💡 Hint
Think about how adding a third dimension adds more information.
✗ Incorrect
3D plots display three variables at once, allowing us to see how they relate together in space, which 2D plots cannot show.
🔧 Debug
advanced2:00remaining
Identify the error in 3D plot code
What error does the following MATLAB code produce when trying to plot a 3D surface?
MATLAB
x = 1:5; y = 1:5; [X,Y] = meshgrid(x,y); Z = X + Y; surf(x,y,Z);
Attempts:
2 left
💡 Hint
Check the inputs to surf and their sizes.
✗ Incorrect
No error, the plot displays correctly. surf accepts vectors x and y when length(x) == size(Z,2) and length(y) == size(Z,1), generating the grid internally just like meshgrid.
📝 Syntax
advanced2:00remaining
Correct syntax for 3D plot with meshgrid
Which option shows the correct syntax to create a 3D surface plot of Z = sin(X) * cos(Y) using meshgrid?
Attempts:
2 left
💡 Hint
Remember to use element-wise multiplication .* for matrices.
✗ Incorrect
Option B correctly creates meshgrid matrices X and Y, computes element-wise multiplication with .*, and plots with surf.
🚀 Application
expert3:00remaining
Interpreting complex 3D plot relationships
Given a 3D plot of Z = X.^2 - Y.^2, what shape does the surface represent and what does it tell about the relationship between X, Y, and Z?
Attempts:
2 left
💡 Hint
Think about how positive and negative squared terms affect the surface shape.
✗ Incorrect
The surface is a hyperbolic paraboloid (saddle shape). Z grows positively with X squared and negatively with Y squared, showing complex opposing relationships.