function A=poisson_matrix(N,c)

% "N": order of the tridiagonal, diagonally dominant matrix "A", stemming from
%      the solution of the Poisson problem, via a finite difference method.
% "c": non positive coefficient, depending on the Poisson problem.

h=1/(N+1);

diag_mat=diag((1/h^2)*ones(N,1));

T_lower=[diag_mat(:,2:N) zeros(N,1)];
T_upper=[zeros(N,1) diag_mat(:,1:(N-1))];
T_diagonal=diag( ((-2+c*h^2)/h^2)*ones(N,1) );

A=T_lower+T_upper+T_diagonal;