function analytickyModelVersMDK1d_prestupTepla()

% -k*u''(x) + (2alfa/r)*u(x) = f + (2alfa/r)*U  v (0,1)
%       -k*u'(0) + alfa*u(0) = alfa*U
%       -k*u'(1) - alfa*u(1) = -alfa*U

f = 1000; k = 3; alfa = 10; r = 0.1; U = -5;
lambda1 = -sqrt(2*alfa/r/k); lambda2 = sqrt(2*alfa/r/k);
E1 = exp(lambda1); E2 = exp(lambda2);
c = [-k*lambda1+alfa,-k*lambda2+alfa;E1*(-k*lambda1-alfa),E2*(-k*lambda2-alfa)] \ [-f*r/2;f*r/2];

u = @(x) (c(1)*exp(lambda1*x)+c(2)*exp(lambda2*x)+f*r/2/alfa+U);

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


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