0
0
MATLABdata~10 mins

Matrix creation 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 3x3 matrix of zeros.

MATLAB
A = [1](3,3);
Drag options to blanks, or click blank then click option'
Aeye
Bones
Czeros
Drand
Attempts:
3 left
💡 Hint
Common Mistakes
Using ones instead of zeros creates a matrix of ones.
Using eye creates an identity matrix, not zeros.
2fill in blank
medium

Complete the code to create a 4x4 identity matrix.

MATLAB
I = [1](4);
Drag options to blanks, or click blank then click option'
Azeros
Beye
Cones
Drand
Attempts:
3 left
💡 Hint
Common Mistakes
Using zeros creates a matrix of zeros, not identity.
Using ones creates a matrix of ones, not identity.
3fill in blank
hard

Fix the error in the code to create a 2x5 matrix filled with ones.

MATLAB
M = [1](2, 5);
Drag options to blanks, or click blank then click option'
Azeros
Beye
Crand
Dones
Attempts:
3 left
💡 Hint
Common Mistakes
Using zeros creates a matrix of zeros.
Using eye creates an identity matrix, which is square.
4fill in blank
hard

Fill both blanks to create a 3x3 matrix with random values between 0 and 1.

MATLAB
R = [1]([2], 3);
Drag options to blanks, or click blank then click option'
Arand
B3
C4
Drandn
Attempts:
3 left
💡 Hint
Common Mistakes
Using randn generates random numbers with a normal distribution.
Using wrong size arguments causes dimension errors.
5fill in blank
hard

Fill both blanks to create a 2x4 matrix of twos using element-wise multiplication.

MATLAB
M = [1](2, 4) [2] 2;
Drag options to blanks, or click blank then click option'
Aones
B*
D.*
Attempts:
3 left
💡 Hint
Common Mistakes
Using regular multiplication * instead of element-wise .* causes errors.
Leaving the last blank with an operator causes syntax errors.