Help with assessing learners work
Ältere Kommentare anzeigen
Hi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner's code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error('Matrix Is Not Square') ;
% Check Matrix For Singularity
elseif det(A) == 0
error('Matrix Is Not Invertible Since |A|=0') ;
% Inform The User The Matrix Can Be Inverted
else
disp('The Matrix Is Invertible') ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
end
2 Kommentare
Kuda
am 22 Jan. 2025
Cris LaPierre
am 24 Jan. 2025
Can you share an example?
When I modify the code that creates RREF but not UTM and then run your assessment tests, UTM is marked correct and RREF is marked incorrect, as you desire.

Antworten (1)
Cris LaPierre
am 24 Jan. 2025
Bearbeitet: Cris LaPierre
am 24 Jan. 2025
0 Stimmen
Given my comment above, I wonder if the learner solution contains a syntax error.
If yes, then everything is marked incorrect. Incorrect assessments return an error. Here, the solution code is throwing the error, not the assessment tests. The result is that all tests are determined to be incorrect. In this case, the syntax error must be fixed before the assessment tests can perform as expected.
The Output section and the red default feedback will contain the error message. Learners can also use 'Open in MATLAB Online' to see the output as it would appear in MATLAB, which might help with debugging.
So, for example, if introduce the following syntax error:
RREF(k,:) = RREF(k,:).-RREF(k,l)*RREF(l,:)
% ^
MATLAB Grader will display these results:

Kategorien
Mehr zu Octave finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!