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?
plot(1:5, [10 20 30 40 50]);
axis([0 6 0 60]);
disp(xlim);
A[0 5]
B[1 5]
C[10 50]
D[0 6]
Step-by-Step Solution
Solution:
  1. Step 1: Understand axis limits set by axis command

    The command axis([0 6 0 60]) sets x-axis limits to 0 and 6, y-axis limits to 0 and 60.
  2. Step 2: Check what xlim returns

    xlim returns the current x-axis limits, which are [0 6].
  3. Final Answer:

    [0 6] -> Option D
  4. Quick Check:

    axis sets limits, xlim returns x-axis limits [OK]
Quick Trick: axis sets limits; xlim returns current x-axis limits [OK]
Common Mistakes:
  • Assuming xlim returns data range
  • Confusing xlim with ylim
  • Ignoring axis command effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes