What symbol is used for a solid line style in MATLAB plots?
The solid line style is represented by a single dash: '-'.
Click to reveal answer
beginner
How do you specify a red color for a plot line in MATLAB?
Use the character 'r' to specify red color in the plot command.
Click to reveal answer
beginner
Name three marker symbols you can use in MATLAB plots.
Common markers include: 'o' (circle), '*' (star), and 's' (square).
Click to reveal answer
intermediate
How do you combine line style, marker, and color in one plot command?
You combine them as a string, for example: '-or' means solid line -, circle marker o, and red color r.
Click to reveal answer
beginner
What is the default line style and marker if none is specified in MATLAB plot?
The default is a solid line '-' with no markers.
Click to reveal answer
Which of these is the correct way to plot a blue dashed line with square markers in MATLAB?
Aplot(x, y, '--bs')
Bplot(x, y, '-ro')
Cplot(x, y, ':g*')
Dplot(x, y, '-.k^')
✗ Incorrect
Option A uses '--' for dashed line, 'b' for blue color, and 's' for square markers.
What marker symbol represents a star in MATLAB plots?
Ao
B*
Cs
Dd
✗ Incorrect
The star marker is represented by '*'.
How do you specify a green dotted line in MATLAB?
A'--g'
B'-g'
C':g'
D'-.g'
✗ Incorrect
The dotted line style is ':', so ':g' means green dotted line.
If you want no markers but a red dash-dot line, which style string do you use?
A'-.r'
B'-r'
C'--r'
D':r'
✗ Incorrect
Dash-dot line style is '-.', so '-.r' means red dash-dot line with no markers.
Which color code represents black in MATLAB plot commands?
Ag
Bb
Cr
Dk
✗ Incorrect
The letter 'k' is used for black color.
Explain how to create a plot line in MATLAB with a green dashed line, circle markers, and no fill color.
Remember the order of line style, marker, and color can be combined in one string.
You got /4 concepts.
List and describe the basic line styles and marker symbols available in MATLAB plotting.
Think about common shapes and line patterns you see in graphs.
You got /3 concepts.
Practice
(1/5)
1. Which of the following is the correct way to plot a red dashed line with circle markers in MATLAB?
easy
A. plot(x, y, 'ro-')
B. plot(x, y, '-ro')
C. plot(x, y, 'o-r')
D. plot(x, y, 'r--o')
Solution
Step 1: Understand MATLAB line style syntax
In MATLAB, the format 'color lineStyle marker' is used inside the plot command, for example 'r--o' means red color, dashed line, and circle markers.
Step 2: Match the correct order
The correct order is color first ('r'), then line style ('--'), then marker ('o'). So 'r--o' is correct.
Final Answer:
plot(x, y, 'r--o') -> Option D
Quick Check:
Color + line style + marker = 'r--o' [OK]
Hint: Remember order: color, line style, then marker [OK]
Common Mistakes:
Putting marker before line style
Using wrong order of characters
Confusing color codes with markers
2. Which of the following MATLAB plot commands will produce a blue solid line with square markers?
easy
A. plot(x, y, 'b-s')
B. plot(x, y, 'sb:')
C. plot(x, y, 'b:sq')
D. plot(x, y, 'bs:')
Solution
Step 1: Identify the correct syntax for blue solid line with square markers
In MATLAB, 'b' means blue, '-' means solid line, and 's' means square marker. The order is color, line style, marker.
Step 2: Check each option
plot(x, y, 'b-s') 'b-s' correctly follows the order: blue color, solid line, square marker.
Final Answer:
plot(x, y, 'b-s') -> Option A
Quick Check:
Color + line style + marker = 'b-s' [OK]
Hint: Use 'color-lineStyle-marker' order in plot string [OK]
Common Mistakes:
Mixing order of marker and line style
Using invalid marker codes
Adding extra characters like 'sq'
3. What will be the color and style of the line plotted by this command?
plot(x, y, 'g:*')
medium
A. Green dotted line with star markers
B. Green solid line with star markers
C. Green dash-dot line with star markers
D. Green dashed line with star markers
Solution
Step 1: Decode the plot style string 'g:*'
'g' means green color, ':' means dotted line style, and '*' means star markers.
Step 2: Combine the meanings
The line will be green, dotted, with star markers.
Final Answer:
Green dotted line with star markers -> Option A
Quick Check:
Color = green, line style = dotted, marker = star [OK]
Hint: ':' means dotted line, '*' means star marker [OK]
Common Mistakes:
Confusing ':' with dash-dot line
Mixing marker and line style symbols
Assuming solid line by default
4. Identify the error in this MATLAB plot command:
plot(x, y, 'r--x-o')
medium
A. Color code 'r' is incorrect
B. Multiple markers specified, which is invalid
C. Line style '--' cannot be combined with markers
D. Missing semicolon at the end
Solution
Step 1: Analyze the plot style string 'r--x-o'
This string tries to specify two markers: 'x' and 'o', which is not allowed in MATLAB plot format.
Step 2: Understand MATLAB plot style rules
Only one marker can be specified along with one line style and one color. Multiple markers are invalid.
Final Answer:
Multiple markers specified, which is invalid -> Option B
Quick Check:
Only one marker allowed in plot style [OK]
Hint: Use only one marker symbol in plot style string [OK]
Common Mistakes:
Adding multiple markers in one style string
Ignoring MATLAB plot style syntax rules
Thinking semicolon affects plot style
5. You want to plot two lines on the same graph: one with a green dash-dot line and circle markers, and the other with a magenta dotted line and square markers. Which MATLAB code correctly does this?
hard
A. plot(x1, y1, 'g-.o'); plot(x2, y2, 'm:s');
B. plot(x1, y1, 'g-o.'); hold on; plot(x2, y2, 'm.s:'); hold off;
C. plot(x1, y1, 'g-.o'); hold on; plot(x2, y2, 'm:s'); hold off;
D. plot(x1, y1, 'g:o-'); hold on; plot(x2, y2, 'm-s.'); hold off;
Solution
Step 1: Understand the required styles
First line: green ('g'), dash-dot ('-.'), circle marker ('o'). Second line: magenta ('m'), dotted (':'), square marker ('s').
Step 2: Check each option for correct syntax and use of 'hold on'
plot(x1, y1, 'g-.o'); hold on; plot(x2, y2, 'm:s'); hold off; uses 'g-.o' and 'm:s' correctly and uses 'hold on' to plot both lines on the same graph.
Step 3: Verify other options
plot(x1, y1, 'g-o.'); hold on; plot(x2, y2, 'm.s:'); hold off; and D have incorrect order or invalid style strings. plot(x1, y1, 'g-.o'); plot(x2, y2, 'm:s'); misses 'hold on' so second plot overwrites first.
Final Answer:
plot(x1, y1, 'g-.o'); hold on; plot(x2, y2, 'm:s'); hold off; -> Option C
Quick Check:
Use correct style strings and 'hold on' to combine plots [OK]
Hint: Use 'hold on' to plot multiple lines with different styles [OK]
Common Mistakes:
Forgetting 'hold on' to keep previous plots
Mixing order of line style and marker
Using invalid style strings like 'g:o-'
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.