function RieszovaProjekceL2doH1_1d()

f = @(x) (heaviside(x-1/2));


P = 0:0.01:1;
n = length(P);
E = [1:(n-1);2:n];

% MKP
e = ones(1,n-1);
Ae1 = @(ke,xe) ( (xe(2)-xe(1))*[1,-1;-1,1] );
Ae2 = @(qe,xe) ( qe*(xe(2)-xe(1))*[1/3,1/6;1/6,1/3] );
be = @(fe,xe) (fe*(xe(2)-xe(1))/2*[1;1]);
fe = f((P(1:(n-1))+P(2:n))/2);
[A,b] = MKP(P,E,{Ae1,Ae2},{e,e},{be},{fe},[],[],[],[]);

u = A\b;
plot(P,f(P),'b',P,u','r')
