I am trying to isolve a trajectory optimization problem in cvx using mosek solver. I have linearized my equations of motion to have the state vector along the trajectory linearized.

After that, I try to solve a convex problem using this linearized state vector. I have included a constraint in which the position in module (the three first components) of x_LIN should be equal to r_GEO (the radius of a GEO orbit). Like this:

norm(X_lin(end,1:3)) == r_GEO]; % Final position.

But I am obtaining this error:

Error using vertcat

The following error occurred converting from logical to cvxcnst:

Not enough input arguments.

Thank you in advance for any help.

If you are using CVX 3.0beta, remove all CVX directories from your MATLAB path, then install CVX 2.2 in a new MATLAB session. `cvx_version`

shows which CVX version you are using. CVX 3.0beta is riddled with bugs which almost certainly will never be fixed.

Perhaps the problem is with your code. Please show a complete reproducible problem, with all input data, and no undefined functions, at least up to the statement in which the error occurs.

Ans what is the `]`

before the semicolon? That looks rather odd, and non-compliant with any MATLAB or CVX syntax. If there were a `[`

before `norm`

, that could be consistent with YALMIP code, although this was posted on a CVX forum.

It may also be possible that there is another version of some function n your MATLAB path which is being called (from within a CVX function) instead of the function CVX is expecting to call. Use of

`which -all function_name`

may help diagnose that by showing al the versions of `function_name`

and their order in your MATLAB path.

Hi. Thank you so much for your answer:

I am already using the version cvx 2.2.

The line code is without]:

norm(X_lin(end,1:3))== r_GEO

The problem I want to solve is the optimal transfer between a LEO and GEO in order to obtain the Hohmann Transfer. For doing so I am using the tecnique sequential convex optimization.

Inputs:

Problem: I am propagating the equations of motion to obtain the state vector linearized along the trajectory based on an initial guess. Once I have linearized my equations of motion. I proceed to implement the convex subproblem.

In my convex subproblem the variable is u which is the vector of impulses along the trajectory. I should obtain a first impulse at the beginning of the transfer trajectory to go from a LEO to the transfer orbit, and then a second impulse to go from the transfer orbit to a GEO.

My cost function: the sum of the two needed impulses using the variable u.

My constraints: an impulse contraint defining a maximum of the total impulse with it is okay. The contraint in the final position in which I am having the error I have written above and a trust region constraint which I am having a similar error as for the boundary constraint.

After that I proceed to solve the problem with the cost function and the constraints defined before. But I am not getting to that point.

I do not know why vertcat is used in the constraint. The function is in cvx and other toolbox in matlab.

Actually, I think vertcat is used because the put the constraints I am using the structure:

constraint = [ ];

and to add a constraint for example in this case I am writting:

constraint = [constraint; norm(X_lin(end,1:3))== r_GEO];

Thank you in advance for your help.

As I hinted at before, that is YALMIP code, not CVX code. You should seek YALMIP support at https://groups.google.com/g/yalmip?pli=1 , not on this forum, which is for CVX. But I’ll give you a hint, the dimension of the existing `constraint`

is apparently non-conformal with the dimension of the constraint you are adding.

If you are actually trying to use CVX, rather than YALMIP, you need to read the CVX Users’ Guide, because what you have done is not the way to enter constraints in CVX.

As a suggestion no matter what forum you are posting on, a high level description of the topic and approach of your research project is not a substitute for reproducible code for purposes of getting assistance for an error message produced by code you haven’t shown…