I'm looking for the matlab code for this one. Wikipedia has an example:
i := 1
j := 1
while (i ≤ m and j ≤ n) do
Find pivot in column j, starting in row i:
maxi := i
for k := i+1 to m do
if abs(A[k,j]) > abs(A[maxi,j]) then
maxi := k
if A[maxi,j] ≠ 0 then
swap rows i and maxi, but do not change the value of i
Now A[i,j] will contain the old value of A[maxi,j].
divide each entry in row i by A[i,j]
Now A[i,j] will have the value 1.
for u := i+1 to m do
subtract A[u,j] * row i from row u
Now A[u,j] will be 0, since A[u,j] - A[i,j] * A[u,j] = A[u,j] - 1 * A[u,j] = 0.
i := i + 1
j := j + 1
I want to say this is sufficient for the example in the picture. Does anybody know for sure?
% SET UP COUNTERS
% GET SIZE OF MATRIX
'ERROR MATRIX NON SINGULAR'
% PERMUTE RAW IF i different then k
% ALGORITHM OF BACKWARD SUBSTITUTION
This would work for a matrix, but not for this matrix in the picture. Because equations aren't provided in the proper format. Line 4 has : F3-10=0. So the code would have to move the 10 so that it will be F3=10
Do you know how I could do this? There's another equation where it has to move the 10 to the right.