0
0
MATLABdata~10 mins

Row and column vectors 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 create a row vector with elements 1 to 5.

MATLAB
v = [1 [1] 5];
Drag options to blanks, or click blank then click option'
A:
B;
C,
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using a semicolon ; inside square brackets creates a column vector, not a row vector.
Using a comma , is valid but not the best way to create a sequence.
2fill in blank
medium

Complete the code to create a column vector with elements 1 to 5.

MATLAB
v = [1[1]5]';
Drag options to blanks, or click blank then click option'
A.
B:
C,
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using a semicolon ; creates [1;5]' which is row [1 5].
Using a comma , creates [1,5]' which is column [1;5] but only two elements.
3fill in blank
hard

Fix the error in the code to create a column vector with elements 1 to 3.

MATLAB
v = [1 [1] 3]';
Drag options to blanks, or click blank then click option'
A:
B,
C;
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using a semicolon ; creates [1;3]' row [1 3].
Using a comma , creates [1,3]' column [1;3] only two elements.
4fill in blank
hard

Complete the code to create a row vector with elements 2 to 8.

MATLAB
v = [[1] : 8];
Drag options to blanks, or click blank then click option'
A2
B:
C,
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using semicolon ; creates a column vector, not a row vector.
Using commas , without the colon operator does not create a sequence.
5fill in blank
hard

Complete the code to create a column vector with elements 5 to 15.

MATLAB
v = [[1]:15]';
Drag options to blanks, or click blank then click option'
A5
B:
C;
D,
Attempts:
3 left
💡 Hint
Common Mistakes
Using commas , creates a row vector before transpose.
Not using the colon operator fails to create the full sequence.