Custom CVX Functions - Overriding Errors

I have constructed a function in Matlab that is convex and increasing (qualitatively similar to an exponential function but I am hoping to avoid the successive approximation requirement of exp). In my specification of the function I take a minimum of two convex functions which of course does not, in general, result in a convex function; however for the functions I am using, the result is convex. My function is

function y = cost( x )
y = min( inv_pos( -x ), max( square_pos( x + 3 )/4, 1 ) );

For those unfamiliar with CVX syntax, the function is min( 1/max(-x,0), max(max(x+3,0)^2/4, 1) ). CVX throws the error:

Disciplined convex programming error:
Cannot perform the operation min( {convex}, {convex} )

Is there any way to convince CVX that my function is indeed convex? Talking to it hasn’t been working.


No, there is not. CVX doesn’t have the rules it does for arbitrary reasons. They are directly related to the approach it uses to convert problems to solvable form. So it is non-negotiable: if you cannot express a function according to the rules, then CVX cannot handle it, because it cannot convert it to solvable form.