function porovnaniMKDaAnalytReseni()

l = 1;
k = 1;
f = 1;
ustriska = 1;
taustriska = 1;
r = 1;
alfa = 1;

beta = 2*alfa/r;
g = f+beta*ustriska;

figure; hold on
for n=10:10:100;
    h = l/n;
    x = 0:h:l;

    A1 = (k/h^2)*spdiags(ones(n-1,1)*[-1,2,-1],-1:1,n-1,n-1);
    A2 = beta*spdiags(ones(n-1,1),0,n-1,n-1);
    A = sparse(n+1,n+1);
    A(1,1) = 1;
    A(2:n,2:n) = A1+A2;
    A(2,1) = -k/h^2*1;
    A(n,n+1) = -k/h^2*1;
    A(n+1,n:n+1) = -(k/h)*[-1,1];
    b = [ustriska;g*ones(n-1,1);taustriska];

    u = A\b;
    plot(x,u');
    n
end

c = sqrt(beta/k);
a = [exp(0),exp(0);-k*[-c*exp(-c*l),c*exp(c*l)]] \ [ustriska-g/beta;taustriska];
u = a(1)*exp(-c*x)+a(2)*exp(c*x) + g/beta;

hold on;
plot(x,u,'r')