function analytickyModelVersMDK1d()

% -k*u''(x) = 1 v (0,1)
%      u(0) = 0
%  -k*u'(1) = 1

k = 3;
u = @(x) (-(1/k)*(x.^2)/2);

xx = linspace(0,1,100);
plot(xx,u(xx))

for n = 10:10:200;
    h = 1/n;
    A = zeros(n+1,n+1);
    b = [0;ones(n-1,1);1];
    
    A(1,1) = 1;
    A(n+1,[n,n+1]) = k/h * [1,-1];
    for i=1:n-1
        A(i+1,[i,i+1,i+2]) = k/h^2 * [-1,2,-1];
    end
    uh = A\b;
    
    hold on; plot(0:h:1,uh')
    pause
end