0
0
MATLABdata~20 mins

Line styles, markers, and colors in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Line Style Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this MATLAB plot command?
Consider the following MATLAB code snippet:
plot(1:5, 'r--o')

What does this command produce in terms of line style, marker, and color?
MATLAB
plot(1:5, 'r--o')
AA red solid line with square markers
BA blue solid line with circle markers
CA red dashed line with circle markers
DA green dotted line with star markers
Attempts:
2 left
💡 Hint
The string 'r--o' specifies color, line style, and marker in that order.
Predict Output
intermediate
2:00remaining
What color and marker does this plot use?
Given the MATLAB command:
plot(1:3, 'g:*')

What is the color, line style, and marker used?
MATLAB
plot(1:3, 'g:*')
AGreen solid line with circle markers
BGreen dotted line with star markers
CBlue dotted line with star markers
DRed dashed line with square markers
Attempts:
2 left
💡 Hint
The order is color, line style, then marker.
Predict Output
advanced
2:00remaining
What is the output of this MATLAB plot command with multiple style characters?
Analyze the MATLAB command:
plot(1:4, 'b-.s')

What line style, marker, and color does this produce?
MATLAB
plot(1:4, 'b-.s')
ABlue dash-dot line with square markers
BBlue dashed line with circle markers
CBlack dash-dot line with square markers
DBlue solid line with star markers
Attempts:
2 left
💡 Hint
Remember 'b' is blue, '-.' is dash-dot line, and 's' is square marker.
Predict Output
advanced
2:00remaining
What error or output does this MATLAB plot command produce?
Consider this MATLAB command:
plot(1:5, 'r-o-')

What happens when you run this?
MATLAB
plot(1:5, 'r-o-')
APlots a red dotted line with square markers
BPlots a red solid line with circle markers
CPlots a red dashed line with circle markers
DSyntax error due to invalid line style string
Attempts:
2 left
💡 Hint
Line style strings must be in a valid order and format.
🧠 Conceptual
expert
3: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?
A315
B63
C441
D49
Attempts:
2 left
💡 Hint
Multiply the number of options for each category.