Bird
0
0

Which command combination correctly plots two different functions on the same figure in MATLAB?

easy📝 Conceptual Q2 of 15
MATLAB - 2D Plotting
Which command combination correctly plots two different functions on the same figure in MATLAB?
Ahold on; plot(x, y1); hold off; plot(x, y2);
Bplot(x, y1); plot(x, y2);
Cplot(x, y1); hold on; plot(x, y2);
Dplot(x, y1); hold off; plot(x, y2);
Step-by-Step Solution
Solution:
  1. Step 1: Plot first function

    Use plot(x, y1) to draw the first line.
  2. Step 2: Use hold on before plotting second function

    Calling hold on keeps the first plot visible so the second plot plot(x, y2) adds to the same figure.
  3. Final Answer:

    plot(x, y1); hold on; plot(x, y2); -> Option C
  4. Quick Check:

    Use hold on between plots = A [OK]
Quick Trick: Always use hold on before second plot to combine [OK]
Common Mistakes:
  • Omitting hold on causes second plot to erase first
  • Using hold off before second plot erases first
  • Calling hold on after second plot has no effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes