function priklad()

% priklad()
%   Funkce demonstruje konvergenci metody konecnych
%   prvku pri zmensovani diskretizacniho parametru h.
%   Resime variacne ulohu: -(tau(x)*u'(x))'+q(x)*u = f(x) v (k,l)
%                           u(k) = u(l) = 0
%                           tau(a)*(u'(a+) - u'(a-)) = fa

% Zadani ulohy
fce_tau = 'struna';
fce_q = 'podlozka';
fce_f = 'zatez';
k = 0;
l = 1;
a = 0.8;
fa = 0.5;

% Aproximace pro h = 0.5
h = 0.5;
[x1,e] = diskret(k,l,h);
I0 = [1,max(size(x1))];
[A,b] = assemble(fce_tau,fce_q,fce_f,a,fa,x1,e,I0);
u1 = A\b;

% Aproximace pro h = 0.1
h = 0.1;
[x2,e] = diskret(k,l,h);
I0 = [1,max(size(x2))];
[A,b] = assemble(fce_tau,fce_q,fce_f,a,fa,x2,e,I0);
u2 = A\b;

% Aproximace pro h = 0.05
h = 0.05;
[x3,e] = diskret(k,l,h);
I0 = [1,max(size(x3))];
[A,b] = assemble(fce_tau,fce_q,fce_f,a,fa,x3,e,I0);
u3 = A\b;

% Aproximace pro h = 0.01
h = 0.01;
[x4,e] = diskret(k,l,h);
I0 = [1,max(size(x4))];
[A,b] = assemble(fce_tau,fce_q,fce_f,a,fa,x4,e,I0);
u4 = A\b;

% Vykresleni vysledku
plot(x1,u1,'g',x2,u2,'b',x3,u3,'k',x4,u4,'m');
