0
0
MATLABdata~10 mins

Scatter plots 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 basic scatter plot of x and y.

MATLAB
x = 1:5;
y = [2, 4, 6, 8, 10];
scatter(x, [1]);
Drag options to blanks, or click blank then click option'
Ax
B1:5
C[1,2,3]
Dy
Attempts:
3 left
💡 Hint
Common Mistakes
Using x twice instead of y for the second argument.
Passing a range instead of the y vector.
2fill in blank
medium

Complete the code to add red color to the scatter plot points.

MATLAB
x = 1:5;
y = [3, 6, 9, 12, 15];
scatter(x, y, 36, [1]);
Drag options to blanks, or click blank then click option'
A'yellow'
B'red'
C'green'
D'blue'
Attempts:
3 left
💡 Hint
Common Mistakes
Using color names without quotes.
Using an unsupported color string.
3fill in blank
hard

Fix the error in the code to plot a scatter with circle markers.

MATLAB
x = 1:4;
y = [5, 10, 15, 20];
scatter(x, y, 100, 'b', [1]);
Drag options to blanks, or click blank then click option'
A'o'
B'*'
C's'
D'x'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' which is star marker, not circle.
Omitting quotes around the marker.
4fill in blank
hard

Fill both blanks to create a scatter plot with blue square markers and size 50.

MATLAB
x = 1:3;
y = [7, 14, 21];
scatter(x, y, [1], [2], 's');
Drag options to blanks, or click blank then click option'
A50
B'red'
C'blue'
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping size and color arguments.
Using wrong marker type.
5fill in blank
hard

Fill all three blanks to create a scatter plot with green diamond markers, size 75, and label the x-axis as 'Time'.

MATLAB
x = 1:4;
y = [10, 20, 30, 40];
scatter(x, y, [1], [2], '[3]');
xlabel('Time');
Drag options to blanks, or click blank then click option'
A75
B'green'
C'd'
D'o'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong marker character.
Forgetting quotes around color or marker.