% Ex5
%------
% fonction Laplacien1D
function A1 = Laplacien1D(n)
  N = n;
  A1 = sparse(N,N);
%   A1 = zeros(N,N); pour stockage PLEIN
% 1ere methode:
  for i = 1:N
      A1(i,i) = 2;
  end
  for i = 2:N
      A1(i,i-1) = -1;
  end
  for i = 1:N-1
      A1(i,i+1) = -1;
  end
% 2eme methode
%  e = ones(N,1);
%  A1 = spdiags([-e 2*e -e], -1:1, N, N);

 A1=(N+1)^2*A1;