function priklad2_1d()

% -u''(x) + u(x) = 10 v (0,1)
% u(0) = 0
% u'(1) = 3

m = 16;
n = m+1; h = 1/m;

f = 10*ones(1,m);
k = 1*ones(1,m);
q = 0.5*ones(1,m);

% diskretizace
x = linspace(0,1,n);
E = [1:(n-1);2:n];

% okr. podm.
Dirichlet = [1]; uD = [2];
Neumann = [n]; tau = 3;

% MKP
Ae1 = @(ke,xe) ( ke/(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]);
[A,b] = MKP(x,E,{Ae1,Ae2},{k,q},{be},{f},Dirichlet,uD,Neumann,tau);

% reseni
u = A\b;
plot(x,[uD,u'])

