function MKDversMKPv1d(h)

%
% analyticke reseni
%
xx = 0:0.001:1;
uPresne = -0.5*xx.^2;


%
% MKD
%
x = 0:h:1;
n = length(x)-1;
A = zeros(n+1,n+1);
b = zeros(n+1,1);
for i=1:n-1
    A(i,i) = -1/h^2;
    A(i,i+1) = 2/h^2;
    A(i,i+2) = -1/h^2;
    b(i) = 1;
end
A(n,1) = 1;
A(n+1,n) = 1/h;
A(n+1,n+1) = -1/h;
b(n+1) = 1;
%
uMKD = A\b;


%
% MKP
%
n = length(x)-1;
A = zeros(n,n);
b = zeros(n,1);
for i=1:n-1
    A(i,i) = 2/h;
    A(i,i+1) = -1/h;
    A(i+1,i) = -1/h;
    b(i) = h;
end
A(n,n) = 1/h;
b(n) = h/2-1;
%
uMKP = A\b;


plot(xx,uPresne,'r',x,uMKD','bo',x,[0;uMKP]','k--')