Question: We will make function files 1) function (UC)=GE_m[A,b) and 2) function x=ut sys[U) on MATLAB by using Gauss Elimination. While we were finding the Upper

 We will make function files 1) function (UC)=GE_m[A,b) and 2) function

x=ut sys[U) on MATLAB by using Gauss Elimination. While we were finding

the Upper triangular matrix, we will see the pivot entry is zero.

If this case happens, we will swap the rows. I try to

We will make function files 1) function (UC)=GE_m[A,b) and 2) function x=ut sys[U) on MATLAB by using Gauss Elimination. While we were finding the Upper triangular matrix, we will see the pivot entry is zero. If this case happens, we will swap the rows. I try to explain next. function (Uc]=GE_m[A,b) n=length (b) for k=1:n-1 use 'while" ( %locate row that contains 1st nonzero % among n'n possible entries) If r=k, no need to swap ( % Ifr not= k, swap rth and kth row, % then go them GE If r>n disp (If all possible pivot entries have zero, print out "A is not invertible and the U and c returned are meaningless." Then quit out) After we will check our code on commend window for this example. Command window: 1) >> A=(1-12-1 2-2 3-3 1110 1-143] >> b= [-8-20 2 4]' transpose >>[U.c)=GE_m(A.b) >>x=ut_sys(U.c) check both funtion match 2) >> A=[1 11 221 112] >> b= [466]' transpose >> [U.c]=GE_m(A,b) should get U= [111 00-1 001) and c=[ 4,-2, 2]' transpose. Because we did elimination such that; 1. R2-2R1__R2 and R3__R3-R1 we will see A is not invertible 2. R2_-R2 3. R1 R2-2R1 and R3__R3-R1 so we will see 2nd row has no solution U: upper triangular matrix. Mine old code is here if it is possible you can modify this code. function x=ut_sys(u.c) n=length(c): function (A,b]=gauss_eliminationn(A,b) x=zeros(n:1); x(n)=c(n)/(n.n); n=length(b); for k=1:n-1 for j=kin-1 b(j+1)=(A[j+1,KWA(K.k)*(-1))*(b(K)))+b(j+1); A[j+1,:)=(A[j+1,k)/A(k.k))*(-1))*(A(k.:)))+A[j+1.:): end for k=n-1:-1:1 for j=k:-1:1 x(k)=x(k)/(kk); end x(j)=x(j)-uj,k+1)*x(k+1): x=x'; end end end end We will make function files 1) function (UC)=GE_m[A,b) and 2) function x=ut sys[U) on MATLAB by using Gauss Elimination. While we were finding the Upper triangular matrix, we will see the pivot entry is zero. If this case happens, we will swap the rows. I try to explain next. function (Uc]=GE_m[A,b) n=length (b) for k=1:n-1 use 'while" ( %locate row that contains 1st nonzero % among n'n possible entries) If r=k, no need to swap ( % Ifr not= k, swap rth and kth row, % then go them GE If r>n disp (If all possible pivot entries have zero, print out "A is not invertible and the U and c returned are meaningless." Then quit out) After we will check our code on commend window for this example. Command window: 1) >> A=(1-12-1 2-2 3-3 1110 1-143] >> b= [-8-20 2 4]' transpose >>[U.c)=GE_m(A.b) >>x=ut_sys(U.c) check both funtion match 2) >> A=[1 11 221 112] >> b= [466]' transpose >> [U.c]=GE_m(A,b) should get U= [111 00-1 001) and c=[ 4,-2, 2]' transpose. Because we did elimination such that; 1. R2-2R1__R2 and R3__R3-R1 we will see A is not invertible 2. R2_-R2 3. R1 R2-2R1 and R3__R3-R1 so we will see 2nd row has no solution U: upper triangular matrix. Mine old code is here if it is possible you can modify this code. function x=ut_sys(u.c) n=length(c): function (A,b]=gauss_eliminationn(A,b) x=zeros(n:1); x(n)=c(n)/(n.n); n=length(b); for k=1:n-1 for j=kin-1 b(j+1)=(A[j+1,KWA(K.k)*(-1))*(b(K)))+b(j+1); A[j+1,:)=(A[j+1,k)/A(k.k))*(-1))*(A(k.:)))+A[j+1.:): end for k=n-1:-1:1 for j=k:-1:1 x(k)=x(k)/(kk); end x(j)=x(j)-uj,k+1)*x(k+1): x=x'; end end end 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!