Cognitive functions are often studied by recording electric potentials from the brain over repeated presentations of a sensory stimulus or repeated performance of a motor action. Each repetition is called a trial. Recent work has demonstrated that contrary to the traditional view, the event-related potential (ERP) can vary from trial to trial and the background ongoing activity often contains rich information about the cognitive state of the brain. Based on such a variable signal plus ongoing activity model, an iterative parameter estimation method is proposed in which both the single-trial parameters of the ERP and the autoregressive representation of the ongoing activity are obtained simultaneously. This technique, referred to as the analysis of single-trial ERP and ongoing activities method, is first tested on simulation examples, and then applied to the local field potential recordings from monkeys performing a visuomotor task.