% Second-order finite difference discretization of the viscously damped
% wave equation:  u_{tt}(x,t) = u_{xx}(x,t) - 2 a(x) u_t(x,t) with 
% u(0,t)=u(1,t)=0.

 N = 64;
 h = 1/N;

 x = h*[1:N-1]';

 a = 3/2+sin(3*pi*x);   % damping function

 Z = zeros(N-1);
 I = eye(N-1);
 K = -(1/h^2)*(-2*eye(N-1)+diag(ones(N-2,1),1)+diag(ones(N-2,1),-1));
 D = 2*diag(a);

 A = [Z I; -K -D];

 figure(1), clf
 plot(eig(A),'k.','markersize',12)
 axis([-5 1 -50 50]);
