I want to solve this fractional programming, but something wrong in my code


indent preformatted text by 4 spaces
clc,clear;
close all;

cvx_begin
variables x y
maximize y
subject to
3x+1-y(2*x+2)>=0
x>=0
y>=0
cvx_end

Related to


BTW, your problem is convex:
\frac{{3x + 1}}{{2x + 2}} = \frac{3}{2} - \frac{1}{{x + 1}} \ge y
you never get the optimal value \frac{{3}}{{ 2}} unless x=+ \infty

Also check out the solution strategy at https://docs.mosek.com/modeling-cookbook/linear.html#homogenization