0
0
MATLABdata~20 mins

Row and column vectors in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Vector Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this MATLAB code?
Consider the following MATLAB code that creates a row vector and a column vector. What will be the size of B after execution?
MATLAB
A = [1, 2, 3, 4];
B = A';
A4 1
B4 4
C1 4
D1 1
Attempts:
2 left
💡 Hint
Remember that the apostrophe (') operator transposes the vector.
Predict Output
intermediate
2:00remaining
What is the output of this MATLAB code?
What will be the output of the following code snippet?
MATLAB
v = [5; 10; 15];
result = v(2);
A5
B10
CError: Index exceeds matrix dimensions.
D15
Attempts:
2 left
💡 Hint
Indexing in MATLAB starts at 1 and works down the column for column vectors.
Predict Output
advanced
2:00remaining
What is the output of this MATLAB code involving vector multiplication?
Given the row vector r = [1 2 3] and column vector c = [4; 5; 6], what is the result of r * c?
MATLAB
r = [1 2 3];
c = [4; 5; 6];
result = r * c;
A32
B[4 10 18]
C[4; 10; 18]
DError: Inner matrix dimensions must agree.
Attempts:
2 left
💡 Hint
Matrix multiplication rules: number of columns in first must equal number of rows in second.
Predict Output
advanced
2:00remaining
What error does this MATLAB code produce?
What error will this code produce?
MATLAB
r = [1 2 3];
c = [4 5 6];
result = r * c;
A[4 10 18]
B18
CError: Inner matrix dimensions must agree.
DError: Undefined function or variable 'result'.
Attempts:
2 left
💡 Hint
Check the dimensions of the vectors for matrix multiplication.
🧠 Conceptual
expert
2:00remaining
How many elements are in the resulting vector?
If you create a row vector R = 1:7 and a column vector C = (1:7)', what is the number of elements in the vector V = R + C'?
A49
BError: Matrix dimensions must agree.
C1
D7
Attempts:
2 left
💡 Hint
Check the dimensions of R, C, and C' before addition.