Non differentiable optimisation problem |x|

Hey there, I am starting from scratch learning CVX at the moment. I wondered if you could show more work examples for non-differentiable optimisation problems. Here is my random example:

f = @(x) abs(x)

N = 128;
x = linspace(-1, 3, 200)’;
T = @(x) feval(chebpoly(0:N-1), x);
Tx = T(x);
fx=f(x);
cvx_begin
variable c(N)
minimize( norm( Tx * c - fx, 2 ) );
cvx_end

In my codes, I want to interpolate |x| with a Chebyshev series. However, because of a lack of understanding, the accuracy of my codes is very poor. Is there any way to improve it? Any CVX notes for non-differentiable optimisation problems? Would learn better with sample codes and illustrations. Thank you in advance.

CVX can directly handle such non-differentiable functions as abs(x) and norm(x) in several different “norms”. if you want maximum accuracy, use these built-in capabilities. If for some pedagogical (?) reason you want to approximate these, you must follow CVX’s rules.

Have you read the CVX Users’ Guide? There are CVX examples at http://cvxr.com/cvx/examples/ as well as in posts on this forum.