## 1 Introduction
Indeed, since the POS and layout design only consider a single frequency, the in-band behaviour of the array rapidly deteriorates [24]. Moreover, due to the intermediate step of computing the far field in the near field synthesis of [19; 22], that algorithm is restricted to a single near field plane that is parallel to the array aperture. In order to overcome those limitations, this work proposes a general near field beam-shaping technique for the wideband optimization of spatially fed arrays. Specifically, the new analysis technique allows computation of the near field in a volume with an arbitrary local coordinate system rotated by three angles with regard to the array, as well as to perform a wideband direct layout optimization by taking into account the full electromagnetic response of the unit cell at several frequencies as provided by the use of a full-wave electromagnetic tool assuming local periodicity directly in the optimization loop. To that end, first two near field models for spatially fed arrays are presented. One model is based on the radiation equations directly derived from the A and F vector potentials [25]. The volumetric integrals are particularized to planar arrays discretized into a number of constituent elements. The resulting surface integrals are evaluated by means of the mid point quadrature, evaluating their convergence for different discretization grids. The second model is based on the superposition of the far fields radiated by each array element, which are modelled as small rectangular apertures with constant field on them. The far field is obtained with [PERSON]'s principle of equivalence for aperture antenna [26]. In addition, a formulation is given to have the possibility of computing the near field in an arbitrary local coordinate system which is rotated and translated with regard to the array local coordinate system, which might be useful depending on the application. Both near field models are then compared by considering the near field radiated by a transmitarray antenna, showing a high degree of agreement between the two models. Then, the faster model is applied to a novel technique for the wideband near field beam-shaping based on the generalized intersection approach (GIA) [21]. This technique performs a direct layout optimization employing a method of moments based on local periodicity (MoM-LP) directly in the optimization loop to account for the real electromagnetic response of the unit cell at several frequencies of interest, including mutual coupling between the array elements. In this way, a general near field multi-frequency optimization algorithm is obtained. As an example of application, it is applied to an indoor scenario in which it is desired to provide coverage in a private office with a 5G NR femtocell working in the n257 band, which comprises the frequency range 26.5-29.5 GHz, corresponding to a 10.7% relative bandwidth. The optimization procedure with the GIA is divided into several stages to facilitate convergence towards a suitable solution. The final optimized array presents a maximum magnitude ripple in the enlarged coverage area of 1.5 dB over the whole n257 bandwidth, showing the suitability of the proposed methodology for the wideband near field beam-shaping of spatially fed array antennas.