Here is my code.

clear;

syms v_gamma;

cvx_begin

variables gamma_1 gamma_2 gamma_3 gamma_4 gamma_5 Sgamma;

k1 = 2; k2 = 4; k3 = 5; k4 = 6;

```
p_gamma = (10.5 / sqrt(2*pi))*exp((v_gamma - 10)^2/-2*0.128^2);
BER_gamma_1 = ((0.2 * exp(-1.6*v_gamma*Sgamma/(0.4072*2^k1 - 1)))) * p_gamma;
BER_gamma_2 = ((0.2 * exp(-1.6*v_gamma*Sgamma/(0.4072*2^k2 - 1)))) * p_gamma;
BER_gamma_3 = ((0.2 * exp(-1.6*v_gamma*Sgamma/(0.4072*2^k3 - 1)))) * p_gamma;
BER_gamma_4 = ((0.2 * exp(-1.6*v_gamma*Sgamma/(0.4072*2^k4 - 1)))) * p_gamma;
S_gamma = Sgamma*p_gamma;
f = k1*int(p_gamma, 'v_gamma', 'gamma_1', 'gamma_2') + ...
k2*int(p_gamma, 'v_gamma', 'gamma_2', 'gamma_3') + ...
k3*int(p_gamma, 'v_gamma', 'gamma_3', 'gamma_4') + ...
k4*int(p_gamma, 'v_gamma', 'gamma_4', 'gamma_5');
g = k1 * int(BER_gamma_1, 'v_gamma', 'gamma_1', 'gamma_2') + ...
k2 * int(BER_gamma_2, 'v_gamma', 'gamma_2', 'gamma_3') + ...
k3 * int(BER_gamma_3, 'v_gamma', 'gamma_3', 'gamma_4') + ...
k4 * int(BER_gamma_4, 'v_gamma', 'gamma_4', 'gamma_5');
maximize(f);
subject to
int(S_gamma, 'v_gamma', 0, inf) <= 0.1658;
g/f == 10^-3;
```

cvx_end

and here is my error code

Unable to convert ‘cvx’ to ‘sym’.

I had a problem with v_gamma * Sgamma, which were variables. So, I declared v_gamma as a symbolic but I don’t know how to fix it. I need your advice. Please help me.