function[x] = G_S(A,b,x0,e,M)
n = size(A,1);
x = zeros(n,1);
for m = 1 : M
for p=1 : n
s = 0;
t = 0;
for q=1 : p-1
s = s + A(p,q) * x(q);
end
for q = p + 1 : n
t = t + A(p,q) * x0(q);
end
x§ = -(s + t - b§)/A(p,p);
end
if norm(x - x0, Inf) < e
break;
else
x0 = x;
end
end
if m == M
disp(‘达到最大循环次数’);
end
end
05-23
10-29
564
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)