Hi experts,

```
Today is my second day using CVX and I am wondering if I can use CVX to optimize below problem: wH is the only variable, s_H is a given matrix. I want to find the second highest peak of the abs(wH'*s_H) and then minimize this second peak. Matlab has a function called" findpeaks" but I cannot use here since this function does not accept cvx variables. I can also write a findpeak function but I am not sure whether CVX will accept that either. Can I get some advice on how to easily achieve peak finding which is suitable for CVX? Many thanks!
```

cvx_begin

variable wH(N,1) complex

Array_factor=(abs(wH’*s_H));

SLL_h=findpeaks(Array_factor_norm_h);

SLL_h=sort(SLL_h, ‘descend’);

SLL_h_max=SLL_h(2);

minimize(SLL_h_max);

cvx_end

error message on findpeaks function:

Error in findpeaks>parse_inputs (line 199)

validateattributes(Yin,{‘double’,‘single’},{‘nonempty’,‘real’,‘vector’},…