  A flexible and effective algorithm for complex roots and poles finding is
presented. A wide class of analytic functions can be analyzed, and any
arbitrarily shaped search region can be considered. The method is very simple
and intuitive. It is based on sampling a function at the nodes of a regular
mesh, and on the analysis of the function phase. As a result, a set of
candidate regions is created and then the roots/poles are verified using a
discretized Cauchy's argument principle. The accuracy of the results can be
improved by the application of a self-adaptive mesh. The effectiveness of the
presented technique is supported by numerical tests involving different types
of structures, where electromagnetic waves are guided and radiated. The results
are verified, and the computational efficiency of the method is examined.
