Fitting piecewise linear function

Hi,

I have some data which needs to fit the convex piecewise linear function
max_i(a*v_i+b*s_i)

I want to determine the values of a and b from the fit. Is there a function in cvx that can do the fitting or do I have to write the iterative algorithm myself? Also, are there examples for convex piecewise linear fitting in the software package that I could look at?

Thanks
Aparna

You could take a look at this code:

http://web.cvxr.com/cvx/examples/cvxbook/Ch06_approx_fitting/html/convex_interpolation.html

But no, CVX cannot do this for you.

Thanks for the help.

Hi, Michael C. Grant.
Now I have some three-dimensional data points such as (x,y,z),Could you please tell me how to fit these data points to a convex function such as z=f(x,y)?Or could please give a example?
Thank you very much.

In addition,The result that is obtained by the way of (http://web.cvxr.com/cvx/examples/cvxbook/Ch06_approx_fitting/html/convex_interpolation.html) seemly can not use in cvx when the variable is a vector.