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

liWrite a matlab function for gaussian elimination based off of the followingi

smax psuedo code function Gauss(n, (aij), (li)) integer i, j, k, n real 0

for j =1 to n

smax r, rmax, smax, xmult real array (aij)1:n x 1:n, (li)1:n; real arraymax(smax, abs.value(aij)

end for

si allocate (si)1:n for i = 1 to n lii smax 0 for smax

end for

for k = 1 to n-1

rmax j =1 to n smax max(smax, abs.value(aij) end for si smax end 0

for i = k to n

r for for k = 1 to n-1 rmax 0 for i = abs. value (aij/sl_i) %l_i = li

if (r > rmax) then

rmax k to n r abs. value (aij/sl_i) %l_i = li if (r r

j > rmax) then rmax r j i end if end for lj i

end if

end for

lj lk for i = k +1 to n xmult al_i,k/al_k,k al_i,k xmultlk

for i = k +1 to n

xmult for j = k+1 to n al_i,j al_i,j -(xmult)*al_k,j end for end al_i,k/al_k,k

al_i,k for end for deallocate array (si) end function Gauss xmult

for j = k+1 to n

al_i,j image text in transcribed 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!