Bird
0
0

What output does this MATLAB code produce?

medium📝 Predict Output Q5 of 15
MATLAB - 2D Plotting
What output does this MATLAB code produce?
data = randn(1,100);
histogram(data, 10);
AA line plot of 100 random values
BA histogram with 10 bins showing the distribution of 100 random values
CAn error because histogram requires a matrix input
DA scatter plot of 10 points
Step-by-Step Solution
Solution:
  1. Step 1: Understand histogram function

    histogram(data,10) creates a histogram with 10 bins showing frequency distribution of data.
  2. Step 2: Check data input and options

    data is a vector of 100 random values; histogram accepts vector input; no error expected.
  3. Final Answer:

    A histogram with 10 bins showing the distribution of 100 random values -> Option B
  4. Quick Check:

    histogram with bins shows distribution = A [OK]
Quick Trick: histogram(data, bins) shows data distribution in bins [OK]
Common Mistakes:
  • Confusing histogram with line plot
  • Expecting errors with vector input
  • Thinking histogram plots scatter points

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes