Bird
0
0

What will be the output of the following MATLAB code?

medium📝 Predict Output Q4 of 15
MATLAB - 2D Plotting
What will be the output of the following MATLAB code?
x = 1:3;
y = [4 5 6];
scatter(x, y, 100, 'r', 'filled')
AA scatter plot with red filled circles of size 100 at points (1,4), (2,5), (3,6)
BA line plot connecting points (1,4), (2,5), (3,6)
CAn error due to incorrect color specification
DA scatter plot with default blue circles
Step-by-Step Solution
Solution:
  1. Step 1: Analyze scatter function arguments

    The code uses scatter(x, y, 100, 'r', 'filled') which sets marker size to 100, color to red ('r'), and fills the markers.
  2. Step 2: Understand output plot

    The plot will show red filled circles at coordinates (1,4), (2,5), (3,6) with size 100.
  3. Final Answer:

    A scatter plot with red filled circles of size 100 at points (1,4), (2,5), (3,6) -> Option A
  4. Quick Check:

    scatter with size and color = red filled circles [OK]
Quick Trick: Use 'filled' to fill scatter markers with color [OK]
Common Mistakes:
  • Thinking it creates a line plot
  • Assuming default blue color instead of red
  • Confusing marker size with line width

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes