Question: Write a matlab function for gaussian elimination based off of the following psuedo code function Gauss(n, (a ij) , (l i )) integer i, j,
Write a matlab function for gaussian elimination based off of the following psuedo code
function Gauss(n, (aij), (li))
integer i, j, k, n
real r, rmax, smax, xmult
real array (aij)1:n x 1:n, (li)1:n; real array allocate (si)1:n
for i = 1 to n
li
i
smax
0
for j =1 to n
smax
max(smax, abs.value(aij)
end for
si
smax
end for
for k = 1 to n-1
rmax
0
for i = k to n
r
abs. value (aij/sl_i) %l_i = li
if (r > rmax) then
rmax
r
j
i
end if
end for
lj
lk
for i = k +1 to n
xmult
al_i,k/al_k,k
al_i,k
xmult
for j = k+1 to n
al_i,j
al_i,j -(xmult)*al_k,j
end for
end for
end for
deallocate array (si)
end function Gauss
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
