  We investigate a time-harmonic wave problem in a waveguide. By means of
asymptotic analysis techniques, we justify the so-called Fano resonance
phenomenon. More precisely, we show that the scattering matrix considered as a
function of a geometrical parameter $\varepsilon$ and of the frequency
$\lambda$ is in general not continuous at a point
$(\varepsilon,\lambda)=(0,\lambda^0)$ where trapped modes exist. In particular,
we prove that for a given $\varepsilon\ne0$ small, the scattering matrix
exhibits a rapid change for frequencies varying in a neighbourhood of
$\lambda^0$. We use this property to construct examples of waveguides such that
the energy of an incident wave propagating through the structure is perfectly
transmitted (non reflection) or perfectly reflected in monomode regime. We
provide numerical results to illustrate our theorems.
