I wonder why the cvx_optval value is different from the object value obtained through W and R obtained through CVX even though cvx_status is solved

What exactly is your remaining difficulty?

As I wrote above, you should not rely on the value of any CVX expression after cvx_end. Only CVX variables are “guaranteed” (presuming the problem is solved to optimality) to be populated with their optimal values after cvx_ehd. CVX correctly solves the optimal problem, but does not necessarily correctly report the optimal values of CVX expressions; and the values those expressions do have may be inconsistent with each other (as well as with CVX optimal variable values). Nevertheless, the optimization problem is actually solved with the requisite consistency.

Bottom line: You should IGNORE the values of all CVX expressions after cvx_end. They may or may not be correct. Looking at their values does not provide a check on anything. If you want to know the optimal values of CVX expressions, you need to compute them after cvx_end, starting from CVX variable values. Yes, that may be a hassle, but that’s the way CVX was designed, and there is almots no chance CVX will ever be modified to change that behavior. The one sort of exception is if the entirety of the objective function is a CVX expression, in which case cvx_optval is the optimal value of that expression.