Bird
0
0

Which MATLAB command correctly creates a simple line plot of vector x against vector y?

easy📝 Syntax Q12 of 15
MATLAB - 2D Plotting
Which MATLAB command correctly creates a simple line plot of vector x against vector y?
Agraph(x, y)
Bplot(y, x)
Clineplot(x, y)
Dplot(x, y)
Step-by-Step Solution
Solution:
  1. Step 1: Recall MATLAB plotting syntax

    The correct command to plot y versus x is plot(x, y).
  2. Step 2: Evaluate options

    plot(x, y) matches the correct syntax. Options A and C are not valid MATLAB functions. plot(y, x) reverses x and y, which changes the plot.
  3. Final Answer:

    plot(x, y) -> Option D
  4. Quick Check:

    Correct plot syntax = D [OK]
Quick Trick: Use plot(x, y) to graph y vs x [OK]
Common Mistakes:
  • Swapping x and y vectors
  • Using non-existent functions like lineplot or graph
  • Forgetting parentheses in function calls

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes