N = 6; %number of array elements
c = 3e8;
fc = 24e9;
lambda = c/fc;
d = lambda/2;
theta = [-pi/2:pi/30:-pi/6,pi/6:pi/30:pi/2];
n = 0:N-1;
a = exp(-1i*2*pi*d/lambda.*n'.*sin(theta));
theta_t = 0;
theta_j = pi/3;
at = exp(-1i*2*pi*d/lambda.*n*sin(theta_t)).';
aj = exp(-1i*2*pi*d/lambda.*n*sin(theta_j)).';
variable u(N,1) complex
u'*aj == 0.5*N;
What is your question? You seem to have a program which roughly corresponds to the problem statement. I defer to you on the details of indexing, creation of input data, etc. For instance, I don’t know what happened to the 1 on the right-hand side of equation (5).
It runs and produces the same optimal objective value, 3, using 4 different solvers.