Recall & Review
beginner
How do you create a 3x3 matrix with all elements equal to zero in MATLAB?
Use the
zeros(3,3) function. It creates a 3-by-3 matrix filled with zeros.Click to reveal answer
beginner
What MATLAB function creates a 4x4 identity matrix?
Use
eye(4). It creates a 4-by-4 matrix with ones on the diagonal and zeros elsewhere.Click to reveal answer
intermediate
How can you create a matrix with values from 1 to 9 arranged in 3 rows and 3 columns?
Use
reshape(1:9, 3, 3). It reshapes the vector 1 to 9 into a 3x3 matrix.Click to reveal answer
beginner
What does the MATLAB command
rand(2,3) do?It creates a 2-by-3 matrix with random values between 0 and 1.
Click to reveal answer
intermediate
How do you create a matrix filled with the number 7 of size 2x4 in MATLAB?
Use
7 * ones(2,4). The ones function creates a matrix of ones, then multiply by 7.Click to reveal answer
Which MATLAB function creates a matrix with all elements equal to one?
✗ Incorrect
The
ones() function creates a matrix filled with ones.What is the size of the matrix created by
zeros(5,2)?✗ Incorrect
zeros(5,2) creates a matrix with 5 rows and 2 columns.What does
eye(3) produce?✗ Incorrect
eye(3) creates a 3x3 identity matrix with ones on the diagonal.How do you create a 2x3 matrix with random numbers between 0 and 1?
✗ Incorrect
rand(2,3) creates a 2x3 matrix with random values between 0 and 1.Which command reshapes a vector into a matrix?
✗ Incorrect
The
reshape() function changes the shape of a vector or matrix.Explain how to create a matrix of any size filled with a specific number in MATLAB.
Think about starting with a matrix of ones.
You got /3 concepts.
Describe the difference between zeros(), ones(), and eye() functions in MATLAB.
Focus on what each function fills the matrix with.
You got /3 concepts.