How to solve this problem

POW_Pr=linspace(0.1,1,500);
for k=1:length(POW_Pr)

cvx_begin
    variable Ps(k) 
    expressions  S_sd S_rd S_sr S_mrc    
    S_sd=((abs(H_sd))^2./POW_N).*Ps;
    S_rd=POW_Pr(k).*((abs(H_rd))^2./POW_N) ;               
    S_sr=((abs(H_sr))^2./POW_N).*Ps;        

S_mrc=S_sd+(S_rd.*S_sr).*inv_pos((S_rd+S_sr+1));
    
maximize (S_mrc)
   subject to 
   Ps(k)>0;
   Ps(k)+POW_Pr(k)<=p0;
 cvx_end

end
错误使用 .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {convex}

出错 main_ (line 24)
S_mrc=S_sd+(S_rd.*S_sr).*inv_pos((S_rd+S_sr+1));

You have violated CVX’s rules.

S_src appears to be a linear fractional form, so I think you ought to be able to handle this problem per section 4.3.2 “Linear-fractional programming” of “Convex Optimization” by Boyd and Vandenberghe https://web.stanford.edu/~boyd/cvxbook/ . You should probably also read the material earlier in that book on linear fractional functions.

Sincerely thank you for your suggestion, I have read the relevant books and found the problem.