How to write this Matlab code

my code:

cvx_begin

variable y(n) ;

variable s ;

for n=1:K

S=log(1+M*y(n));

SUM=SUM+S;

end

for n=1:K

```
q(n)=((Ek*B(n)*s+(T-K)*y(n)-(sqrt(Ek^2*B(n)^2*s^2-2*(T-K)*(Ek*B(n)+2)*y(n)*s+(T-K)^2*y(n)^2)))/(2*(T-K)*B(n)));
qq(n)=B(n)*q(n);
ST=ST+qq(n);
```

end

maximize(SUM) ;

subject to

ST <= (1-s);

cvx_end

and error is :

Error using .* (line 262)

Disciplined convex programming error:

Invalid quadratic form(s): not a square.

Error in * (line 36)

z = feval( oper, x, y );

Error in convex (line 42)

q(n)=((Ek*B(n) s+(T-K)y(n)-(sqrt(Ek^2B(n)^2s^2-2*(T-K)

*(Ek*B(n)+2)

*y(n)*(T-K)*B(n)));

*s+(T-K)^2*y(n)^2)))/(2