0
0
MATLABdata~20 mins

View angle control in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
View Angle Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of the view angle after this code?
Consider the following MATLAB code that sets the view angle of a 3D plot. What will be the azimuth and elevation angles after running this code?
MATLAB
figure;
plot3(1:10, rand(1,10), rand(1,10));
view(45, 30);
current_view = view;
A[45 30]
B[30 45]
C[0 90]
D[90 0]
Attempts:
2 left
💡 Hint
The view function in MATLAB takes azimuth first, then elevation.
Predict Output
intermediate
2:00remaining
What happens if you call view with a single argument?
What is the effect of calling view(2) in MATLAB on a 3D plot?
MATLAB
figure;
plot3(1:10, rand(1,10), rand(1,10));
view(2);
current_view = view;
A[2 0]
B[0 90]
C[90 0]
D[45 30]
Attempts:
2 left
💡 Hint
Calling view with a single number sets a predefined view.
Predict Output
advanced
2:00remaining
What is the output of this code changing view angles dynamically?
What will be the final azimuth and elevation angles after running this MATLAB code?
MATLAB
figure;
plot3(1:10, rand(1,10), rand(1,10));
for az = 0:45:180
    view(az, 45);
end
final_view = view;
A[0 45]
B[135 45]
C[45 45]
D[180 45]
Attempts:
2 left
💡 Hint
The loop sets the view multiple times, the last one is the final.
Predict Output
advanced
2:00remaining
What error does this code raise?
What error will this MATLAB code produce?
MATLAB
figure;
plot3(1:10, rand(1,10), rand(1,10));
view('top');
AError: Invalid input argument for view
BError: Too many input arguments
CError: Undefined function or variable 'top'
DNo error, sets view to top
Attempts:
2 left
💡 Hint
The view function expects numeric inputs or specific strings like '2D' or '3D'.
🧠 Conceptual
expert
3:00remaining
How to programmatically rotate a 3D plot by 90 degrees around the vertical axis?
Which MATLAB code snippet correctly rotates an existing 3D plot by 90 degrees around the vertical (z) axis from its current view?
Aview(0, 90);
Bview(90, 0);
C
current_view = view;
view(current_view(1) + 90, current_view(2));
Dview(current_view(1), current_view(2) + 90);
Attempts:
2 left
💡 Hint
Azimuth controls rotation around the vertical axis.