Question
Linear equation question
Use Matlab for b) and c) and show all the work

Oct 3,ao16 MTH 301: Matrix Theory and Applications
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Part A)

Solve Axeb 5-5 Eliminate x 0.3 in ea ue get411 e., a) 다 @ み551 d sThe 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 functiSupporting function function [L, U, x] =LUEs timate (Arn, Bm) [a bl size (Am) if (a b) disp Error ); return; end % Seperateし(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 UB (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)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.00

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;

Add a comment
Know the answer?
Add Answer to:
Linear equation question Use Matlab for b) and c) and show all the work Oct 3,ao16...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT