I will try to formulate my question precise as possible. I am aware of there’s a introduction to cvx pdf and a thread about what not to do in CVX. I tried to look in them and see if I could find the answer there before making this new topic.
My question is as follows:
I am trying to solve a simple problem just to try the CVX toolbox. The problem is about “Projectile motion” and the formulas can be seen on this wikipedia page: https://en.wikipedia.org/wiki/Projectile_motion
My idea is that I want to maximize the distance the ball can fly (xmax = vx * vy * 2/ g) and put one constraint so the ball does not go above some fixed height (ymax = vy^2/2*g).
g = 9.82; cvx_begin variables vx vy maximize vx * vy * 2/ g subject to vy^2/2*g <= 5; cvx_end
The problem with this expression is that I am not allowed to multiply two variables with each other since they are not always convex. I found others having the same problem but I haven’t found the solution in theirs topic. I also tried to add constraints for vx > 0 and vy > 0 but that did not help. When I change vx to a fixed value the following problem can be solved… But why?
g = 9.82; vx = 10; cvx_begin variables vy maximize vx * vy * 2/ g subject to vy^2/2*g <= 5; cvx_end
I would really like to get some tips about how to fix it so it can work with CVX.
Thanks in regards.