% Num. Math. - FS 2014 - Serie 7 Aufgabe 3 - Jacobi/Gauss-Seidel iteration

tol=...
k_vec=...
iter_vec=zeros(1,length(k_vec));
for i=1:length(k_vec)
    k=...
    A=...
    b=...
    x0=zeros(size(b));
    [x,iter]=jac(...);
    iter_vec(i)=iter;
end
plot(k_vec,iter_vec)
xlabel('k')
ylabel('Anzahl Iterationen')

% uncomment for Gauss-Seidel
% %repeat for Gauss-Seidel
% for i=1:length(k_vec)
%     k=...
%     A=...
%     b=...
%     x0=zeros(size(b));
%     [x,iter]=gs(...);
%     iter_vec(i)=iter;
% end
% hold on
% plot(k_vec,iter_vec,'r--')
% hold off
% legend('Jacobi','Gauss-Seidel','location','NorthWest')
print('-depsc','pl7_3.eps')

%plot the solution (store the solution x into a Matrix X)
figure
G=numgrid('S',k);
X=G;
X(G>0)=x(G(G>0));
xx=linspace(0,1,k);
yy=linspace(0,1,k);
surf(xx,yy,X)
print('-depsc','pl7_3_sol.eps')
