Part A)




![Part B) solution: Mathlab code to estimate LU for above solved matrix A: A-10 -70; 0 2.5 5; 0 0 6.2] B-17 2.5 6.2 Main functi](//img.homeworklib.com/questions/37191a90-16a6-11ec-bb96-d75840ab9e0b.png?x-oss-process=image/resize,w_560)
![Supporting function function [L, U, x] =LUEs timate (Arn, Bm) [a bl size (Am) if (a b) disp Error ); return; end % Seperate](//img.homeworklib.com/questions/378a3a30-16a6-11ec-ad6b-6be1974f792a.png?x-oss-process=image/resize,w_560)




Program code:
Main function:
Am=[ 10 -7 0; 0 2.5 5; 0 0 6.2]
Bm=[7;2.5;6.2];
LUEstimate(Am,Bm)
Supporting function:
function[L,U,X]=LUEstimate(Am,Bm)
[a b]=size(Am);
if (a ~= b )
disp ( 'Error' );
return;
end;
% Seperate A matrix into L and U
L=zeros(a,a);
U=zeros(a,a);
for i=1:a
% Find L
for k=1:i-1
L(i,k)=Am(i,k);
for j=1:k-1
L(i,k)= L(i,k)-L(i,j)*U(j,k);
end
L(i,k) = L(i,k)/U(k,k);
end
% Find U
for k=i:a
U(i,k) = Am(i,k);
for j=1:i-1
U(i,k)= U(i,k)-L(i,j)*U(j,k);
end
end
end
for i=1:a
L(i,i)=1;
end
% Display L and U
U
L
b=zeros(a,1); % initiation for B
B(1)=Bm(1)/L(1,1);
for i=2:a
%B(i)=Bm(i)-L(i,1)*B(1)-L(i,2)*B(2)-L(i,3)*B(3);
B(i)=-L(i,1)*B(1);
for k=2:i-1
B(i)=B(i)-L(i,k)*B(k);
end;
B(i)=(Bm(i)+B(i))/L(i,i);
end;
B
x=zeros(a,1);
x(a)=B(a)/U(a,a);
i=a-1;
q=0;
while (i~= 0)
x(i)=-U(i,a)*x(a);
q=i+1;
while (q~=a)
x(i)=x(i)-U(i,q)*x(q);
q=q+1;
end;
x(i)=(B(i)+x(i))/U(i,i);
i=i-1;
end;
Solve Axeb 5-5 Eliminate x 0.3 in ea ue get
411 e., a) 다 @ み551 d s
The o Intin hang 忧Moto 1o o 0 0 6 2-1 Mull Mthpt) o.on in een ⓐ and add "thus 0 2.5 : 5 2 e l
牛 与6 丿 0-3
Part B) solution: Mathlab code to estimate LU for above solved matrix A: A-10 -70; 0 2.5 5; 0 0 6.2] B-17 2.5 6.2 Main function: Am 10 -7 0; 0 2.5 5; 0 0 6.2] Bm= [ 7 ; 2 . 5 ; 6.21; LUEstimate (Am, Bnm)
Supporting function function [L, U, x] =LUEs timate (Arn, Bm) [a bl size (Am) if (a b) disp 'Error' ); return; end % Seperate A matrix into L an U L-zeros (a, a) U-zeros (a, a) for i=1 : a % Find L for k=1:i-1 L(i,k)-Arn (1, k) ; for j=1: k-1 し(i,k)= L(i,k)-L (i,j)"U (j , k); end
し(i,k) L(1,k) /U(k,k); = end % Find U for k-i:a U(i,k) = Arn (i,k); for j=1 : i-1 end end end for i-1:a end % Display L and U b-zeros (a, 1); % initiation for B
B (1) =Bn (1) /L (1,1) ; for i-2:a for k-2:i-1 end; B (i)-(Brn (i) +B (i) ) /l. (i, i) ; end; x= zeros (a, 1) ; x (a) =B (a) /U(a, a) ; 1-a-1 ; 9-0 while (i0)
while (q -a) end; end;
Sample Output 10.00000 -7.00000 0.00000 0.00000 2.50000 5.0000e 6.2000e 0.0000e , 00000 10.00000 -7.00000 .00000 2.50000 e.0000e 0.0000e . 00000 5.0000e 6.2000e 1 0 0 7.0000 2.5000 6.2000 ans - 010