function FEM1d_naive(n)

l = 1;
f = @(x) (100 * abs(sin(2*pi*x)));
k = 1;
tau = 1;

x = linspace(0,l,n+1);
f = f(x(1:end-1));
A = zeros(n,n); b = zeros(n,1);
for i=1:n
    b(i) = f(i)*(x(i+1)-x(i))/2;
    if i<n
        b(i) = b(i) + f(i+1) * (x(i+2)-x(i+1))/2;
    end
    if i>1
        A(i-1,i) = -k/(x(i)-x(i-1));
        A(i,i-1) = A(i-1,i);
    end
    A(i,i) = k/(x(i+1)-x(i));
    if i<n
        A(i,i) = A(i,i) + k/(x(i+2)-x(i+1));
        A(i,i+1) = -k/(x(i+2)-x(i+1));
        A(i+1,i) = A(i,i+1);
    end
end
b(n) = b(n) + tau*1;
alfa = A\b;
plot(x,[0,alfa'])
