n  = 20;
a  = 0; b  = 1;     h = (b - a) / n;
Ya = 0; Yb = 0;  % okrajova podminka

x  = (a:h:b)';
x0 = x(2:end-1);
x2 = (x(1:end-1) + x(2:end)) / 2.;

A = diag(ones(n - 1, 1) * 2);
A = A - diag(ones(n - 2, 1), -1);
A = A - diag(ones(n - 2, 1),  1);

fx = exp(-(x0 - 0.4).^2);
B = h * h * fx; 
B(1)   = B(1)   + Ya;
B(end) = B(end) + Yb;

Y = A \ B;
Y = [Ya; Y; Yb];
