Challenge - 5 Problems
Line Style Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this MATLAB plot command?
Consider the following MATLAB code snippet:
What does this command produce in terms of line style, marker, and color?
plot(1:5, 'r--o')
What does this command produce in terms of line style, marker, and color?
MATLAB
plot(1:5, 'r--o')
Attempts:
2 left
💡 Hint
The string 'r--o' specifies color, line style, and marker in that order.
✗ Incorrect
In MATLAB plot syntax, 'r' means red color, '--' means dashed line, and 'o' means circle markers. So the plot shows a red dashed line with circle markers.
❓ Predict Output
intermediate2:00remaining
What color and marker does this plot use?
Given the MATLAB command:
What is the color, line style, and marker used?
plot(1:3, 'g:*')
What is the color, line style, and marker used?
MATLAB
plot(1:3, 'g:*')
Attempts:
2 left
💡 Hint
The order is color, line style, then marker.
✗ Incorrect
'g' means green color, ':' means dotted line, and '*' means star markers.
❓ Predict Output
advanced2:00remaining
What is the output of this MATLAB plot command with multiple style characters?
Analyze the MATLAB command:
What line style, marker, and color does this produce?
plot(1:4, 'b-.s')
What line style, marker, and color does this produce?
MATLAB
plot(1:4, 'b-.s')
Attempts:
2 left
💡 Hint
Remember 'b' is blue, '-.' is dash-dot line, and 's' is square marker.
✗ Incorrect
The color 'b' is blue, '-.' is dash-dot line style, and 's' is square marker.
❓ Predict Output
advanced2:00remaining
What error or output does this MATLAB plot command produce?
Consider this MATLAB command:
What happens when you run this?
plot(1:5, 'r-o-')
What happens when you run this?
MATLAB
plot(1:5, 'r-o-')
Attempts:
2 left
💡 Hint
Line style strings must be in a valid order and format.
✗ Incorrect
The string 'r-o-' is invalid because it repeats line style characters incorrectly, causing a syntax error.
🧠 Conceptual
expert3:00remaining
How many unique line style and marker combinations are possible with MATLAB's basic plot specifiers?
MATLAB basic plot specifiers include 7 colors (b,g,r,c,m,y,k), 7 line styles (-, --, :, -., none, ' ', ''), and 9 marker types (o, +, *, ., x, s, d, ^, v).
How many unique combinations of color, line style, and marker can be created if you must specify exactly one color, one line style, and one marker?
How many unique combinations of color, line style, and marker can be created if you must specify exactly one color, one line style, and one marker?
Attempts:
2 left
💡 Hint
Multiply the number of options for each category.
✗ Incorrect
7 colors × 7 line styles × 9 markers = 441 combinations. However, some line styles like 'none' or empty strings do not produce visible lines, so if excluding those, the count reduces. Assuming all line styles count, answer is 441. But if 'none' and empty strings are excluded (2 styles), then 5 line styles remain: 7×5×9=315.