This is my code:

load(‘C’)

r=C(:,4);

t=C(:,5);n = size(C,1);

N = 100;for i=1:n

eta(i,1) = randn()/2;

endcvx_begin

variable xmaximize r’*x - t’*x

subject to

`ones(n,1)'*x == N x >= zeros(n,1) exp(-x/N) >= eta`

cvx_end

The objective function should clearly be scalar. But it gives the error, “Your objective function is not a scalar”. What am I doing wrong?

Furthermore, if I write the last constraint as follows:

```
for i=1:n
exp(-x(i,1)/N) >= eta(i,1)
end
```

then I get the following error: “Index exceeds matrix dimensions.”