I intercepted a piece of code as follows

cvx_begin

variable x(6); % a vector

fg12=(results2.bus(6,8)^2-results2.bus(6,8)*x(1)*(cos(pi/180*(results2.bus(6,9)-x(4)))+j*(sin(pi/180*(results2.bus(6,9)-…

x(4))))))/conj(results2.branch(12,3)+j*(results2.branch(12,4)));

…

cvx_end

After running, an error has occurred

No function ‘cos’ corresponding to the input parameter of type ‘cvx’ is defined.

How to solve,thanks!

`cos`

is not convex, and is not supported in CVX.

Thanks a lot!!!

But cosine function must be used in cvx, and then how to solve ?

Not using CVX.

Thanks again!

I probably took it too much for granted that the CVX is omnipotent.

YALMIP is closer to (but still not) omnipotent You can use `cos `

in YALMIP when calling non-convex solvers (bit not if calling BARON)…

Now ,I encounter a new question and hope for your help!

When optimizing with cvx, there 's one item in the constraint, it’s ‘|s|^2<=W*C’.s denotes the compound power of a line, W respresents the square of a voltage magnitude, C denotes the square of a current.

In the code I write as ‘square_abs(S(3))<=W(1)*C(3)’, but there exits a error.

Later I rewrite the code as ‘square_abs(S(3))<=1/prod_inv([W(1) C(3)])’,However it’s wrong.

{convex}.<=constant/{convex}. I am eager to solve it.

Thank you!

If `s,W,C`

are all optimization variables, and I presume based on your descriptions of `W`

and `C`

being squares, they are both nonnegative, then

`norm(s)^2 <= W*C`

can be rewritten as `norm(s) <= sqrt(W*C)`

, which fits the form for `rotated_lorentz`

, and therefore can be entered as

`{s,W,C} == rotated_lorentz(length(s))`

or if `s`

is complex, can be entered as

`{s,W,C} == complex_ rotated_lorentz(length(s))`

If `s`

is a scalar`, then length(s) = 1, which is o.k.

Does this handle your situation?

Thanks a lot!!!

This problem, it 's finally solved, and it has been bothering me for a month.

Suddenly, I have found a feeling for the CVX, and it is a great optimization tool.

Thanks you ,again!!! You are a great man!!!

I want to apply for a MOSEK license, and I apply for it as an individual academic identity, but after filling in the message, the web page shows “Personal Academic Licenses cannot be requested from this domain”，Please ask this is why?

Thanks a lot.

Thanks again.

Thank you for your answer.

Usually it is because you are trying to apply for an academic license with an email that does not like an email from an academic institution. Best send an email to Mosek support if you cannot resolve it but you think you are elligible for one.

Thank you for your answer.

A question suddenly came to my mind.

I optimized a power system, which is ‘case14’ with CVX.

cvx_begin

variable S(8)

…

cvx_end

In the above code, S represents the line complex power, and is a complex vector.

In the constraints, there are many conditions involving S, but the result is either no feasible solution, or reduce the condition, the solution is a real value, the fundamental solution is not right.

So how to get a feasible complex solution?

For example, with the fmincon solver in matlab, the initial value can be set as a complex number to guide the solution

I am sorry, I understand the root of the problem.

Thanks.