  Generalized Dyck paths (or discrete excursions) are one-dimensional paths
that take their steps in a given finite set S, start and end at height 0, and
remain at a non-negative height. Bousquet-M\'elou showed that the generating
function E_k of excursions of height at most k is of the form F_k/F_{k+1},
where the F_k are polynomials satisfying a linear recurrence relation. We give
a combinatorial interpretation of the polynomials F_k and of their recurrence
relation using a transfer matrix method. We then extend our method to enumerate
discrete meanders (or paths that start at 0 and remain at a non-negative
height, but may end anywhere). Finally, we study the particular case where the
set S is symmetric and show that several simplifications occur.
