Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a 2x2 grid of subplots.
MATLAB
subplot([1], 2, 1); plot(1:10);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the number of rows or columns alone instead of their product.
Confusing the order of arguments in subplot.
✗ Incorrect
The first argument in subplot is the number of rows times columns, so 2x2 = 4.
2fill in blank
mediumComplete the code to create the third subplot in a 2x2 grid.
MATLAB
subplot(2, 2, [1]); plot(rand(5));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 4 instead of 3 for the third subplot.
Confusing subplot numbering order.
✗ Incorrect
The third subplot in a 2x2 grid is specified by the third position.
3fill in blank
hardFix the error in the code to create a 3x1 subplot and plot data in the second panel.
MATLAB
subplot(3, [1], 2); plot(sin(1:10));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 3 instead of 1 for the number of columns.
Mixing up rows and columns order.
✗ Incorrect
The second argument is the number of columns, which is 1 for a 3x1 grid.
4fill in blank
hardFill both blanks to create a 2x3 grid and plot in the last panel.
MATLAB
subplot([1], [2], 6); plot(rand(10));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping rows and columns.
Using 6 as the number of rows or columns.
✗ Incorrect
The grid has 2 rows and 3 columns, so the first two arguments are 2 and 3.
5fill in blank
hardFill all three blanks to create a 3x2 grid and plot in the middle panel.
MATLAB
subplot([1], [2], [3]); plot(cos(1:10));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the order of rows and columns.
Using wrong panel number for the middle panel.
✗ Incorrect
The grid is 3 rows and 2 columns, and the middle panel is position 2.