Sometimes in order to generate a signal of interest, a forcing signal is required. Often it is difficult or impossible to measure the characteristics of the forcing signal alone, we are simply able to estimate it based on idealized conditions, which are not precise enough. Thus we are in the situation where we have *y*(*n*) = *x*(*n*) + ƒ(*n*). Here, ƒ(*n*) is the forcing signal, *x*(*n*) is the desired signal, and *y*(*n*) is the measured signal. From this, it is necessary to recover the desired signal *x*(*n*). This can be accomplished under certain mild assumptions. The first is that the general form of the forcing signal is known, for example as a sine wave ƒ(*n*) = *A*sin(*ωn* + *φ*). Second, the signal of interest should be approximately orthogonal to the forcing signal. Although this is not strictly required, deviation from this will lead to error in the estimation of *x*(*n*) and ƒ(*n*). For the example of the sine wave, this means that we should reasonably sure that *x*(*n*) has no component at frequency *ω*. Then, we can extract ƒ̂(*n*) by finding the values of the parameters *A*, *ω* and *φ* that minimize the energy of the residual *r*(*n*) = *y*(*n*) − ƒ̂(*n*).

This creates problems because the minimization is a highly nonlinear problem, especially if *ω* has to be found because the forcing frequency can only be estimated a priori. This problem can be solved by the use of Particle Swarm Optimization (PSO). This is a technique for optimization based upon communication to find the minimum. The function, in this case, the energy of the residual, is evaluated at several points, referred to as particles. These particles then communicate the best location found in order to collectively find the best location. One of the advantages of PSO is that it is better at avoiding local minima than other optimization algorithms.