Matlab code of the paper 'Auto-Determining Mainlobe Width for Beampattern Synthesis via Relaxation Optimization, 2022'