(k)</span>
    cvx_begin <span class="string">quiet</span>
        variables <span class="string">u(m+1)</span> <span class="string">g_x(m+1)</span> <span class="string">g_y(m+1)</span>
        maximize(u(k)-u(m+1))
        subject <span class="string">to</span>
            g_x &gt;= 0;
            g_y &gt;= 0;
            ones(m+1,1)*u' &lt;= u*ones(1,m+1) + (g_x*ones(1,m+1)).*<span class="keyword">...</span>
              (ones(m+1,1)*data(:,1)'-data(:,1)*ones(1,m+1))+<span class="keyword">...</span>
    