Here you can find the Matlab code for the following paper Z. Ding and H. V. Poor Design of THz-NOMA in the Presence of Beam Misalignment, submitted to IEEE Communications Letters