CVX Constraints Violation problem

I’m doing an optimization problem using CVX where the original author said that he used CVX to solve. I have 3 constraints that cause problems
My code is

cvx_begin %quiet %quiet for not producing any screen outputs

variables POP(NEV,t) MxAP(NEV,t) MnAP(NEV,t) Deg(NEV,t) Rup(t) Rdw(t) EPD(NEV,t,day) EPD_minus(NEV,t,day) SOC(NEV,t) CR(NEV,t) Inn(t) cost(t) Ro(NEV,t) DC(NEV)
maximize ( sum(Inn)- sum(cost) ) % the sum was done here
subject to
  % the for loop was done to apply the constraints for each time  
    for k = 1:t %number of hours
        Comp(:,k) = (total_comp(:,k)); 
        k
        %Inn(k) == alpha*(Pregup(k)*Rup(k) + Pregdw(k)*Rdw(k)) + (sum(sum(EPD(:,k,day)*(FPriceD(k,day)+Mk)))); %why the second sum
        Inn(k) == ((Pregup(k)*Rup(k) + Pregdw(k)*Rdw(k))*EvPer(k)) + Beta*(sum(EPD(:,k,day)*EvPer(k)));
        %cost(k)== (sum(sum(EPD(:,k,day)*(FPriceD(k,day)))));
        cost(k)== (sum(EPD(:,k,day)*(FPriceD(k,day))*EvPer(k)))+ (sum(Deg(:,k)));
        Rup(k) == sum(MnAP(:,k));
        Rdw(k) == sum(MxAP(:,k));
        for i = 1:NEV
            
            if k<ttrip(i) 
                Trip(i)=0;
            else
                Trip(i)=trip(i);
            end
                
            sum(EPD(i,:,day)*Comp(i,:) + Ro(i,:))*Ef + SOCI(i) -Trip(i) <= Mci(i);
            sum(EPD(i,:,day)*Comp(i,:) + Ro(i,:))*Ef + SOCI(i) -Trip(i) >= 0;
            if k==t
            sum(EPD(i,:,day)*Comp(i,:) + Ro(i,:))*Ef + SOCI(i) -Trip(i) >= 0.99*Mci(i);
            end
            
            if k == 1
                (MxAP(i,k) + POP(i,k))*Ef*Comp(i,k) + SOC(i,k) <= Mci(i);
                (POP(i,k)- MxAP(i,k))*Ef*Comp(i,k) + SOC(i,k) >= 0; % To make sure that energy in the battery is not 0 at beginning of work
                SOC(i,k) == SOCI(i);
            elseif k > 1 && k <= t
                (MxAP(i,k) + POP(i,k))*Ef*Comp(i,k) + SOC(i,k) <= Mci(i);
                (POP(i,k)- MxAP(i,k))*Ef*Comp(i,k) + SOC(i,k) >= 0;
                SOC(i,k) == EPD(i,k-1,day) + SOC(i,k-1);
            
            end
            
            (POP(i,1) - MnAP(i,1) + Ro(i,1))*Comp(i,1)*Ef + SOCI(i) >=0;
            (POP(i,k) - MnAP(i,k) + Ro(i,k))*Comp(i,k)*Ef + SOCI(i) >=0.5*Mci(i) %SOC is higher than 50% at any time
            (MxAP(i,k) + POP(i,k))*Comp(i,k) <= MP(i);
             MnAP(i,k) <= POP(i,k) + MP(i);
            POP(i,k) <= MP(i);
            MxAP(i,k) >= 0;
            MnAP(i,k) >= 0;
            POP(i,k) >= -MP(i);
            Deg(i,k)>=0;
            DC(i)==0.042*(BatC/5000)+ ((1-Ef^2)/Ef)*Beta;
            Deg(i,k)>= (DC(i)*EPD_minus(i,k,day)*(Comp(i,k)/Ef));
            
            Ro(i,k)==(Deg(i,k)/DC(i))*((1-Ef^2)/Ef);
            

            EPD(i,k,day) == (MxAP(i,k)*ExD(k,day) + POP(i,k) - MnAP(i,k)*ExU(k,day));
            EPD_minus(i,k,day) == (POP(i,k) - MnAP(i,k)*ExU(k,day)); % more conservative than the previous
        end
    end

cvx_end

The first constraint is
Deg(i,k)>= (DC(i)EPD_minus(i,k,day)(Comp(i,k)/Ef));
and I got the error:
Error using cvx/times (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

If I erase this constraint and ran the program I got an error related to this constraint
Ro(i,k)==(Deg(i,k)/DC(i))*((1-Ef^2)/Ef);
and the error is
Error using cvx/times (line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {real affine}

I hope if I can get some help from you

I suggest that you speak with the original author. There’s no way we can tell you what his intentions are here, but CVX is correct to reject the constraints as you have written them. Indeed, the model is nonconvex as written. Perhaps he can tell you the proper way to represent them.