0
0
MATLABdata~10 mins

plot3 for 3D lines in MATLAB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to plot a 3D line using plot3.

MATLAB
x = 1:5;
y = 2:6;
z = 3:7;
plot3(x, y, [1]);
Drag options to blanks, or click blank then click option'
Az
By
Cx
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using y or x instead of z for the third argument.
Passing a single number instead of a vector.
2fill in blank
medium

Complete the code to add grid lines to the 3D plot.

MATLAB
x = 0:0.5:2*pi;
y = sin(x);
z = cos(x);
plot3(x, y, z);
grid [1];
Drag options to blanks, or click blank then click option'
Ashow
Bon
Coff
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'off' which hides the grid.
Using 'true' or 'show' which are not valid options.
3fill in blank
hard

Fix the error in the code to plot a red dashed 3D line.

MATLAB
x = 0:1:10;
y = x.^2;
z = sqrt(x);
plot3(x, y, z, '[1]');
Drag options to blanks, or click blank then click option'
A'k:'
B'b--'
C'g-.'
D'r--'
Attempts:
3 left
💡 Hint
Common Mistakes
Using blue or green color codes instead of red.
Using solid line style instead of dashed.
4fill in blank
hard

Fill both blanks to create a 3D plot with markers and a green solid line.

MATLAB
x = 1:4;
y = [2, 4, 6, 8];
z = [1, 3, 5, 7];
plot3(x, y, z, '[1][2]');
Drag options to blanks, or click blank then click option'
A'o'
B'g'
C'-'
D'r'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up color and marker symbols.
Using red color instead of green.
5fill in blank
hard

Fill all three blanks to create a 3D plot with blue dash-dot line, and line width 2.

MATLAB
x = linspace(0, 2*pi, 10);
y = sin(x);
z = cos(x);
h = plot3(x, y, z, '[1][2]');
h.LineWidth = [3];
Drag options to blanks, or click blank then click option'
A'b'
B'o'
C'-.'
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong line style symbols.
Setting line width as a string instead of a number.