Why is `B0_A - (2*P_A) + ((1-rho_A)*2*N0*gammaA/rho_A)` invalid?

which rule did i disobey?

P_A=max( (N0*gammaBC)/(rho_BC*(f_A'*H_AB'*H_AB*f_A)) , (N0*gammaBC)/(rho_BC*(f_A'*H_AC'*H_AC*f_A) ) );

B2_A=B0_A - (2*P_A) + ((1-rho_A)*2*N0*gammaA/rho_A)-(2*P_de)
In the code above, the only variables is P_de

Why does the command window tell me

> Error using  +  (line 83)
> Disciplined convex programming error:
>    Illegal operation: {invalid} - {real affine}
> 
> Error in  -  (line 21)
> z = plus( x, y, true, cheat );
> 
> Error in opt_A (line 55)
> B2_A=B0_A - (2*P_A) + ((1-rho_A)*2*N0*gammaA/rho_A)-(2*P_de)

It seems that the invalid is B0_A - (2*P_A) + ((1-rho_A)*2*N0*gammaA/rho_A),but why is it invalid?

Perhaps one of the MATLAB variables us NaN. That would create an invalid expression it was used in. Specifically, what is the value of Bo_A ?

Bo_A is 10,not zero,so it confused me

Look at the value of everything in the statement which triggered the error message.