function prikladGalerkin1d()

E1 = 1;
E2 = 5;
f = 1;
a = 0.5;
l = 1;
tau = 1;

xi = 0:0.01:l;

syms x

figure
hold on
for n=1:20
    
    A = zeros(n,n);
    b = zeros(n,1);    
    for i=1:n
        fi = x^i; %sin(i*x);
        dfi = diff(fi,x);
        for j=1:n
            fj = x^j; %sin(j*x);
            dfj = diff(fj,x);
            A(i,j) = E1*int(dfi*dfj,x,0,a) + E2*int(dfi*dfj,x,a,l);
        end
        b(i) = f * int(fi,x,0,l) + tau*l^i;%sin(i*l);
    end
    
    alfa = A\b;
    
    u = zeros(1,length(xi));
    for j=1:n
        u = u + alfa(j)*sin(j*xi);
    end
    plot(xi,u)
    pause
    
end
