function [A,b,Avlnka] = mkp1d(uzly,prvky,k,f,u0,tau)

m = size(prvky,2);
n = length(uzly);

Avlnka = zeros(n,n);
bvlnka = zeros(n,1);

for l=1:m
  h = uzly(l+1)-uzly(l);
  Al = (k(l)/h) * [1 -1;-1 1];
  bl = (f(l)*h/2) * [1;1];
  idx = [l,l+1];
  Avlnka(idx,idx) = Avlnka(idx,idx) + Al;
  bvlnka(idx) = bvlnka(idx) + bl;
end

bvlnka(n) = bvlnka(n) + tau;
bvlnka = bvlnka - u0*Avlnka(:,1);

A = Avlnka(2:n,2:n);
b = bvlnka(2:n);