# Please how do I sequentially solve my problem towards optimality?

Please help and guide on how to solve this problem sequentially to get optimal values for x(n). I really need to solve this please.
N = 32
n = 1, 2,…N
w = 1/32 or can be normalized to 1
k = 2*pi/lambda
lambda = 1
theta = 1 to 180
half_beamwidth = 10
theta <= (theta_tar-half_beamwidth)
theta >= (theta_tar+half_beamwidth)

f = w∑(exp(ik*x(n)*cos theta))

minimize max(abs(w∑(exp(ik*x(n)*cos theta))))
subject to
f(theta=90) or theta_tar= 1

please how can I write out the codes using Interior Point Method if I chose initial values for x(1), x(2)…x(N)

and then try to repeat the optimization by adding a value to the initial x(n).

Thank you.

Can you formulate a simple example with N = 2 or 4, and explicit variables x1 x2 (x3 x4) ?

Can you formulate the problem using CVX syntax, declaring all variables and having constraints in the CVX format?

You have work to do before we can help you. Or, if you only need to get a good but not optimal solution, use a nonconvex solver such as fmincon, possibly through YALMIP.

Am thinking of setting Initial values for x(n) to say 0.45*(x(n) - 1) and increament the values by 1.

N = 32;
w = 1/N
n = 1, 2,…N;
loc = x(n);
lambda = 1;
theta_tar = 90;
half_beamwidth = 10;
angleRange = 180
theta = [1:angleRange]’;
A = kron(cos(pitheta/180), loc(:,1)’);
A = exp(2
pii/lambdaA);

cvx_begin
variable x(n)
minimize( max( abs(Asw) ) )
subject to
Atar
w == 1;

cvx_end

disp (x(n))

min_sidelobe_level = 20log10( max(abs(Asw)) );
fprintf(1,‘The minimum sidelobe level is %3.2f dB.\n\n’,…
min_sidelobe_level );

Thank you

It looks like you intend w to be a CVX (optimization) variable or expression, but it is not declared or used as such.

x is declared as a CVX (optimization) variable, but doesn’t appear in the objective function or constraints, nor is any expression defined in terms of it.

Atar and As are used in the objective function and constraint, but are not shown anywhere. Are your A = kron… and A = exp… statements supposed to have Atar and As on the left-hand side?

In your first post, it appears you have a typo for the theta <= and theta >= constraints, becauser <= and >= appear to be interchanged (or -half_beamwidth, +half_beamwidth) given that half_beamwidth is positive.

Thank you. Let me check again.

I think I should be more open. I have a problem here!
In the code below, w is a variable. But am attempting to make loc a variable.
Thank you. Am hooked up.

lambda = 1; % wavelength
theta_tar = 90; % target direction (should be an integer – discretization)
half_beamwidth = 10; % half beamwidth around the target direction

n = 32;
L = 5;
loc = L*rand(n,2);
angleRange = 180;

end

% target constraint matrix
[diff_closest, ind_closest] = min( abs(theta - theta_tar) );
Atar = A(ind_closest,:);

%********************************************************************
% optimization data
%********************************************************************

theta = [1:angleRange]’;
A = kron(cos(pitheta/180), loc(:,1)’);
A = exp(2
pii/lambdaA);

% stopband constraint matrix
ind = find(theta <= (theta_tar-half_beamwidth) | …
theta >= (theta_tar+half_beamwidth) );

%********************************************************************
% optimization problem
%********************************************************************
cvx_begin
variable w(n) complex
minimize( max( abs(Asw) ) )
subject to
Atar
w == 1; % target constraint

cvx_end

min_sidelobe_level = 20log10( max(abs(Asw)) );
fprintf(1,‘The minimum sidelobe level is %3.2f dB.\n\n’,…
min_sidelobe_level );

Thank you. You guys are wonderful!

You don’t seem to have addressed the items I pointed out in my previous post. As for wanting to make loc a (CVX?) variable, you have defined it as a random vector, so I have no idea in what way you would like it to be a (CVX) variable…