Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to calculate the determinant of matrix A.
MATLAB
d = [1](A); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum or prod instead of det.
Trying to invert the matrix instead of finding determinant.
✗ Incorrect
The det function calculates the determinant of a matrix in MATLAB.
2fill in blank
mediumComplete the code to calculate the determinant of a 2x2 matrix M.
MATLAB
d = [1](M); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using inv or rank instead of det.
Using trace which sums diagonal elements.
✗ Incorrect
The det function computes the determinant of matrix M.
3fill in blank
hardFix the error in the code to correctly compute the determinant of matrix B.
MATLAB
determinant = [1](B); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum or prod instead of det.
Using inv which computes inverse.
✗ Incorrect
The correct function to compute determinant is det.
4fill in blank
hardFill both blanks to create a function that returns the determinant of input matrix X.
MATLAB
function d = [1](X) d = [2](X); end
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum or inv inside the function instead of det.
Not defining a function name.
✗ Incorrect
The function name can be myDet, and inside it calls det to compute the determinant.
5fill in blank
hardFill all three blanks to compute and display the determinant of matrix A.
MATLAB
A = [1 2; 3 4]; d = [1](A); disp([[2] num2str([3])]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum instead of det.
Not converting number to string before concatenation.
Using wrong variable names.
✗ Incorrect
Use det to get determinant, then display the message with disp combining text and the value.