Why am I getting this error?

Each element of PS is concave due to being nonnegative combinations of the square root of a CVX variable. Therefore, it can’t be squared in CVX.

But why are you calculating it? You use S in SNR, but then never use SNR in your program.

Any correspondence between your code and the optimization problem you are trying to solve seems purely coincidental.

How have you proven that this is a convex optimization problem?