0
0
MATLABdata~5 mins

Matrix creation in MATLAB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aones()
Bzeros()
Ceye()
Drand()
What is the size of the matrix created by zeros(5,2)?
A5 rows and 2 columns
B2 rows and 5 columns
C5 rows and 5 columns
D2 rows and 2 columns
What does eye(3) produce?
A3x3 matrix of ones
B3x3 zero matrix
C3x3 identity matrix
D3x3 random matrix
How do you create a 2x3 matrix with random numbers between 0 and 1?
Aones(2,3)
Brand(2,3)
Czeros(2,3)
Deye(2,3)
Which command reshapes a vector into a matrix?
Arand()
Bzeros()
Ceye()
Dreshape()
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.