function konvergenceCG()

h = 0.01;
[A,b] = mkd1d('sin',h);
x = linspace(0,1,length(b)+2);

u0 = zeros(length(b),1);

n = length(b)
N = 20;

'vlastni funkce Laplaceova operatoru (vlastni kmity struny)'
[V,D] = eig(full(A));
%for i=1:N
%    plot(x,[0;V(:,i);0]');
%    pause(0.5);
%end

lambda1 = min(diag(D));
lambdan = max(diag(D));
omega = 2/(lambda1+lambdan);
'konvergence metody nejv. spadu pro obecnou pravou stranu'
[u,it] = NejvetsiSpad(A,b,u0,1e-6,100000);
it
[u,it] = SdruzeneGradienty(A,b,u0,1e-1,100000);
it

[u,FLAG,RELRES,ITER] = PCG(A,b,1e-1,100000);
ITER
