Question: Please I need help with the following: Write a MATLAB function, called gewop, that solves the linear system Ax=b (withAMn(R),bRn) via Gaussian elimination without pivoting.

Please I need help with the following:

Write a MATLAB function, called gewop, that solves the linear system Ax=b (withAMn(R),bRn) via Gaussian elimination without pivoting. Your code should compute the LU decomposition of A, where the matrices L and U are stored over A. Furthermore, your code should solve the system by solving the lower-triangular system Ly=b (via row-oriented forward substitution) and then solving the upper-triangular system Ux=y (via row-oriented back substitution).

I have the codes for the upper and lower triangular systems.

Lower triangular matrix:

% MATLAB Code for LT matrix G of size n: b=randn(n,1);

for i=1:n

for j=1:i-1

b(i)=b(i)-G(i,j)*b(j);

end

if G(i,i)==0

error(Matrix is singular)

end

b(i)=b(i)/G(i,i);

end

Upper triangular matrix:

for k=1:n

i=n-k+1;

for j=i+1:n

y(i)=y(i)-U(i,j)*y(j);

end

if U(i,i)==0

disp(Matrix is singular)

break

end

y(i)=y(i)/U(i,i);

end

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!