Wednesday, December 4, 2019

Gauss seidel




A=input("Enter the matrix A : ")
b=input("Enter the matrix b : ")
c=input("initial approx")
[r,m]=size(A)
l=1

while l~=10
    for i=1:r
        z=0
        for j=1:m
            if i~=j
                z=z+A(i,j)*c(j)
            end
        end
    c(i)=(b(i)-z)/A(i,i)
end
l=l+1
end
disp(c)


No comments:

Post a Comment