# Transmit Beampattern (Beamforming)

How do I code this optimization problem? I have done it a few times and still get errors. Can somebody help?

Perhaps you can show us what you’re tried, and the errors which occurred. You should presumably intimately understand the notation and conventions in the problem description, whereas forum readers should not be expected to have this understanding.

I would think you would get the values for the different \theta of what comes after max into a vector, which I’ll call joe_blow, and then the objective would be minimize(max(joe_blow)). The constraints look like a matter of correctly indexing, given whatever the notation and conventions are. So it appears to be a straightforward problem form a conic formulation perspective, with the subtlety of dealing correctly with the indexing.

Are there any examples that can help solve this problem? I didn’t know how to input Rx. I tried asking ChatGPT 4. It came up with this code attached below:

DO NOT use ChatGPT to write CVX code. Please read the CVX Users’ Guide, which it is not obvious you’ve done, before posting again.

Presuming Rx is an n by n matrix,
variable Rx(n,n) semidefinite
if its elements are supposed to be real

or

variable Rx(n,n) complex semidefinite
if its elements are supposed to be complex

would declare Rx as a semidefinte matrix (so no need for another semidefinite constraint).

Can you plz suggest any previous examples that can help me with this? I need this for my thesis and if u can help that would be really appreciated.

The first thing is to read the CVX Users’ Guide. You will show your appreciation by carefully reading it.

There are many CVX examples, including in antenna design, at Example library | CVX Research, Inc. . But read the CVX Users’ Guide first.

The code below might be close to the example code you want:

cvx_begin
variable Rx(n,n) complex semidefinite
variable alpha
minimize( max( abs(alpha * B0 - trace(a' * Rx * a)) ) )
subject to
a' * Rx * a <= cSL
trace(Rx) <= Ptot
diag(Rx) <= Pel
% Rx >= 0
cvx_end


Inspired by your method, these codes are mostly generated by a GPT4-like chatbot (kimi.ai) after I feed it the CVX Users’ Guide @Mark_L_Stone mentioned and the image you posted , asking it to write the CVX code for us. With a bit of my modifications to what it wrote, this code seems ok.

What the OP needs to do is figure out the indexing stuff, which requires understanding the notation and conventions.

When I run this code, it gives an answer of “infeasible.”. Also, it doesn’t give me a visible graph. Does anyone know what the problem is here?