Professional Documents
Culture Documents
if (OK == true)
% STEP 9
N1 = NROW(N);
if (abs(A(N1,N)) <= eps)
OK = false;
% system has no unique solution
else
% STEP 10. Start backward substitution
X(N,1) = A(N1,M) / A(N1,N);
% STEP 11
for K = 1:NN
I = NN - K + 1;
JJ = I + 1;
N2 = NROW(I);
SUM = 0;
for KK = JJ:N
SUM = SUM-A(N2,KK)*X(KK);
end
X(I,1) = (A(N2,M) + SUM) / A(N2,I);
end
% STEP 12. Procedure completed successfully
fprintf('\nProcedure completed successfully\n');
fprintf ('with %d row interchange(s)\n', ICHG);
fprintf('\nThe rows have been logically re-ordered to:\n');
NROW
end
if OK == false
fprintf('System has no unique solution\n');
end
end
Prueba del Algoritmo (Valor 20 Puntos)