  In this paper, we propose a new spectral decomposition method to simulate
waves propagating in complicated waveguides. For the numerical solutions of
waveguide scattering problems, an important task is to approximate the
Dirichlet-to-Neumann map efficiently. From previous results, the physical
solution can be decomposed into a family of generalized eigenfunctions, thus we
can write the Dirichlet-to-Neumann map explicitly by these functions. From the
exponential decay of the generalized eigenfunctions, we approximate the
Dirichlet-to-Neumann (DtN) map by a finite truncation and the approximation is
proved to converge exponentially. With the help of the truncated DtN map, the
unbounded domain is truncated into a bounded one, and a variational formulation
for the problem is set up in this bounded domain. The truncated problem is then
solved by a finite element method. The error estimation is also provided for
the numerical algorithm and numerical examples are shown to illustrate the
efficiency of the algorithm.
