i'm getting Error using cvx_end Your objective function is not a scalar. errror

t00=linspace(0,1,9001);%432/10^3; % //for pth>=0.999
t=t00*tcbeta + d*t0./(q*r);
    variables q r
    minimize ( t )
    subject to
        0 <= e <= eth

Your objective function, t, is a constant vector. The objective function must evaluate to a real scalar. I presume you want the objective function to be an expression of variables. Your program is so screwed up I have no idea what optimization problem you are trying to solve, nor whether it is a convex optimization problem which CVX can accept.

When t=t00*tcbeta + d*t0./(q*r); is executed, presumably q and r were previously assigned numerical values in MATLAB. Therefore, t is a constant (i.e., input data) when the CVX portion of the program is executed. Declaring q and r overrides any previous numerical values they had, but that would not change what t is. But then q and r are never used in your CVX program. If t=t00*tcbeta + d*t0./(q*r);; were placed after variables q r, it would not be accepted by CVX because it is neither convex nor concave.

I recommend you carefully read

and also read the entirety of CVX Users’ Guide so that you learn the CVX basics, which you apparently do not understand.