Bird
0
0

Which code snippet correctly achieves this?

hard📝 Application Q15 of 15
MATLAB - 3D Plotting and Visualization
You want to create a MATLAB script that shows a 3D surface plot of peaks and then rotates the view smoothly from azimuth 0 to 360 degrees at elevation 30 degrees. Which code snippet correctly achieves this?
Asurf(peaks); view(0, 30); for az = 0:10:360 pause(0.1); view(az, 30); end
Bfor az = 0:10:360 surf(peaks); view(az, 30); pause(0.1); end
Cfor az = 0:10:360 view(az, 30); surf(peaks); pause(0.1); end
Dsurf(peaks); for az = 0:10:360 view(az, 30); pause(0.1); end
Step-by-Step Solution
Solution:
  1. Step 1: Plot surface once before loop

    Plotting surf(peaks) once before the loop avoids redrawing the plot repeatedly, improving performance.
  2. Step 2: Update view inside loop with pause

    Loop changes azimuth from 0 to 360, updating view angle smoothly with pause(0.1) to see animation.
  3. Final Answer:

    surf(peaks); for az = 0:10:360 view(az, 30); pause(0.1); end -> Option D
  4. Quick Check:

    Plot once, then loop view update = A [OK]
Quick Trick: Plot once, then loop view changes with pause [OK]
Common Mistakes:
  • Plotting inside the loop causing flicker
  • Calling view before surf plot exists
  • Not pausing to see the rotation effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes