The capability to form the main beam of antennas improves the energy efficiency of wireless systems and enhances radar systems' effectiveness in detecting and tracking objects. The time-modulated array can generate multibeam with arbitrary directions in different spectral parts. This work synthesizes several linear arrays to achieve particular main beams and additional restrictions. We modify the pulse durations and the switch-on instants of the switches in each antenna element in an optimization procedure. The parameters are varied through the simulated annealing by minimizing certain cost functions. We designed three linear arrays: model 1 consists of six elements and has two beams. Model 2 is the improved version of model 1 by rejecting the sidelobes of other spectral contributions at the main beam under consideration. Model 3 consists of sixteen elements and has three different beams. The analytical results were verified by modeling the arrays in the form of microstrip arrays in a numerical simulation with HFSS. We obtained very accurate verification. Distinctive devitations at the region ϑ<-60<sup>o</sup> and ϑ>60<sup>o</sup> originate from the radiation characteristics of microstrip antennas, which focus the energy upwards to the region around ϑ=0<sup>o</sup>.<br /><br />