The representation of signals in the time domain requires the decomposition of functions of time into linear combinations of a finite number of basis functions. The purpose of this paper is to introduce a stochastic approximation algorithm, which, given an ensemble of signals

, selects from a set

that subset

of

basis functions that best represents the elements of the ensemble. In this context the optimum representation is defined as the basis set

, which minimizes the expected value of a suitable performance index

, defined as a function of both the basis

and the random signal

. In particular,

is here assumed to be the least-square error that may be achieved when the signal

is approximated by a linear combination of the elements of

. The procedure is analyzed in detail for the case when the basis functions are one-sided complex exponentials. The convergence properties of the algorithm are discussed for this case. An illustrative example of application of the proposed method is also presented.