A = [4 3 0; 3 4 -1; 0 -1 4];
[n, ~] = size(A);
b = [24; 30; -24];
y = A\b; % matlab's solution
x0 = ones(n, 1);
tol = 0.0000000001;
maxit = 100;

[x1, convi1] = mygauss_seidel(A, b, x0, tol, maxit); 
norm(x1 - y)  % compare our solution to the  matlab's one
iters1 = length(conv1); % actual number of iterations
i1 = 1:iters1;

omega = 1.25;
[x2, conv2] = mysor(A, b, x0, tol, maxit, omega); 
norm(x2 - y)  % compare our solution to the  matlab's one
iters2 = length(conv2); % actual number of iterations
i2 = 1:iters2;

plot(i1, log(conv1), 'ko-')
hold on
plot(i2, log(conv2), 'bo-')
hold off
