We present a simple method of constructing synthetic discriminant function filters optimized to take into account the modulation of liquid-crystal devices. This relaxation algorithm, a generalization of the Jared and Ennis method, is an iterative method that includes arbitrary modulations for both scene and filter, extending the problem to the complex plane. Simulated and experimental results obtained in a VanderLugt correlator are presented for a two-class recognition problem. The optimal number of images needed to describe an object in a filter generated in this way is discussed, and the influence of the spatial light modulation resolution on the correlation is studied.