 X = [];
 Y = [];


for n=10:5:100
clear A F u_exact u_c
X = [X n];
F = ones(n,1);
A = eye(n,n);

x = matrix(linspace(0,1,n),n,1);
Dx = 1/(n-1);
u_exact = 1- (exp(x) + exp(1-x))/(1+exp(1));


 F(1) = 0;
 F(n) = 0;

for i=2:n-1
   A(i,i) = A(i,i) + 2./Dx^2;
   A(i,i-1) = -1/Dx^2;
   A(i,i+1) = -1/Dx^2;
end;


u_c = A\F;

xbasc();
plot2d(x,[u_exact u_c],style=[1,-1]);

erreur = norm(u_exact-u_c)/norm(u_exact);
Y = [Y erreur];
end;

xbasc();
plot2d('ll',X,Y);
xtitle(' ','n','Erreur');
