Question: Modify MATLAB function below, named isref, that accepts a matrix as input and returns 1 if the matrix has row echelon form and 0 if
Modify MATLAB function below, named isref, that accepts a matrix as input and returns 1 if the matrix has row echelon form and 0 if it does not.
function classification = isref(A)
% Returns 1 if the matrix A is row echelon; 0 otherwise.
[m n] = size(A); % set the number of rows (m) and columns (n) of A
lastleading = -1; % assures row 1 satisfiews the row echelon condition
classification = 1; % assume A is row echelon until proven otherwise
for r=1:m
% Replace these comments with appropriate MATLAB code that
% checks the leading entry of each row and
% sets classification = 0 if the matrix
% fails to be row echelon.
end
end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
