Hi , I want to write this objective function but I have a problem with writing d as it should be a vector from 1 to S and q is the vector I optimize

This is the expression and q represent m/n

\sum^S_{d=1} \sum^N_{j=1} \gamma_d * P_j *(1 - q)^d

**The optimization variable is q = m_j / n** and all the other variables are inputs

```
M = 100 ; N = 5 ; S = 10; P_j = [ .5 , .1 , .2 , .3 , .4 ] , gammad = [.1 : .1: 1]
cvx_begin
variable q(N)
minimize(sum(sum(gammad'*P_j* (1 - q)^(1:S))))
subject to
sum(q) == M ;
0 <= q <= 100;
cvx_end
```

minimize(sum(sum(gammad’ * Pj.*(1 - q).^d)))

I tried to use this minimize(sum(sum(gammad’*Pj* (bsxfun(@power , (1 - q), (1:S))’)))) but still give error