Answer to Question #327808 in MatLAB for lll

Question #327808

Write a MatLab program to solve the following system of equation using Gauss-Seidel

methad:

54x+y+2=110;2x+ 15y+6z=72;=x+6y+272=85


1
Expert's answer
2022-04-12T16:15:34-0400
n = 3;
A=[54, 1, 2;
    2, 15, 6;
    1, 6, 272];
b = [110; 72; 85];
x = [1; 1; 1];
for iter=1:100
    for i=1:n
        s = 0;
        for j=1:n
            if  j~= i 
                s = s + A(i,j)*x(j);
            end
        end
        x(i) = (b(i) - s) /A(i,i);
    end
end
disp(x)


>> seidel
    1.9468
    4.4576
    0.2070
>> A*x
ans =
  110.0000
   72.0000
   85.0000
>>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS