function priklad3_1d()

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

l = 1; q = 1; alfa = 1; f = 10; ustriska = 1;

kvlevo = 1; kvpravo = 4;

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

f = (f+ustriska*q)*ones(1,m);
k = [kvlevo*ones(1,m/2),kvpravo*ones(1,m/2)];
q = q*ones(1,m);

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

% okr. podm.
Dirichlet = []; uD = [];
Neumann = [1,n]; tau = alfa*ustriska*[1,1]';

% 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);
% modifikace A
A(1,1) = A(1,1) + alfa;
A(n,n) = A(n,n) + alfa;

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

