## 1 Introduction
The generalized intersection approach (GIA) was employed to carry out a phase-only synthesis (POS) in [28] to design a reflectarray for a CATR system. The technique imposes magnitude and phase constraints by means of lower and upper mask templates at a single NF plane and frequency. The same technique was also employed in NF magnitude-only optimizations for reflectarray [32] and transmitarray [34] antennas. Similarly, in [33] magnitude NF requirements are also specified as mask templates on a whole NF plane. However, the POS is carried out by computing the FF generated by the truncated NF according to those masks as an intermediate step before recovering the field at the array aperture, from which the NF is computed again to assess if it complies with specifications. The above-mentioned techniques are able to effectively shape the NF, although they present several drawbacks. First, all of them perform a POS and, thus, the procedure only works at a single frequency. Due to the narrow bandwidth nature of spatially fed arrays [35], this may penalize performance at other frequencies. In addition, the GIA employed in [28; 32; 34] uses a gradient-based technique in the backward projector, which calculates the Jacobian matrix of a cost function. The size of this matrix directly depends on the number of optimizing variables and the number of points at which the NF is calculated, since specifications are implemented with the mask template in all NF points, causing an important memory footprint and slower computations when the NF field is computed in more than one NF plane. On the other hand, the technique employed in [33] avoids the use of a gradient-based algorithm by computing the FF as an intermediate step. However, this limits the technique to the synthesis of NF planes at a single plane parallel to the array. In addition, the technique has only been developed for magnitude-only synthesis, with no NF phase constraints, so it cannot be applied to optimize spatially fed arrays for CATR applications. In view of these limitations, the present paper proposes a new NF in-band synthesis technique for the optimization of reflectarray antennas with general NF constraints in both magnitude and phase. With the proposed technique, and employing a full-wave simulation tool directly in the optimization loop, an in-band synthesis at a number of frequencies is possible. Moreover, there are no restrictions as to at which points the NF is optimized. In addition, to overcome the memory footprint and slower computations derived from the definition of NF constraints by means of upper and lower mask templates for all NF points, the direct optimization of the relevant NF figures of merit (FoM) in both magnitude and phase is proposed. To this end, the volume where the NF is calculated is divided into a series of disjoint regions where these FoM are calculated. A gradient-based minimization algorithm is adopted to take into account these FoM, considerably reducing the memory footprint and accelerating computations. In addition, a comparison with the usual approach described in the literature of employing mask templates in all the NF points shows that the new methodology is able to produce better results in fewer iterations in the final optimized reflectarray, generating a plane wave with lower magnitude and phase ripple.