0
0
MATLABdata~10 mins

Labels, title, and legend 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 add a title to the plot.

MATLAB
plot(x, y)
title([1])
Drag options to blanks, or click blank then click option'
AMy Plot
Btitle
C"My Plot"
Dxlabel
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the title text in quotes.
Using xlabel instead of title.
2fill in blank
medium

Complete the code to label the x-axis.

MATLAB
plot(x, y)
xlabel([1])
Drag options to blanks, or click blank then click option'
A"Time (s)"
BTime (s)
Cx-axis
Dxlabel
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the label text.
Passing a variable name instead of a string.
3fill in blank
hard

Fix the error in the code to add a legend.

MATLAB
plot(x, y1, x, y2)
legend([1])
Drag options to blanks, or click blank then click option'
A["Data1", "Data2"]
B{"Data1", "Data2"}
C'Data1', 'Data2'
D"Data1", "Data2"
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of curly braces.
Passing a single string with commas instead of a cell array.
4fill in blank
hard

Fill both blanks to add labels and a title to the plot.

MATLAB
plot(x, y)
xlabel([1])
title([2])
Drag options to blanks, or click blank then click option'
A"Time (s)"
BTime (s)
C"Sample Data"
DSample Data
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes for the labels.
Swapping xlabel and title.
5fill in blank
hard

Fill all three blanks to add labels, title, and legend to the plot.

MATLAB
plot(x, y1, x, y2)
xlabel([1])
title([2])
legend([3])
Drag options to blanks, or click blank then click option'
A"Time (s)"
B"Experiment Results"
C{"Trial 1", "Trial 2"}
D["Trial 1", "Trial 2"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets for legend labels.
Not quoting xlabel or title text.