Custom Regularization Functions

I am currently trying to solve a problem of the form:

cvx_begin
variable x(n)
minimize norm (A*x - b, 1) + myFun(x)
cvx_end

myFun takes the unknown variable and does a whole bunch of operations on it (gradients etc) using MATLAB’s in-built functions. Because x is initialized as type cvx, i am unable to perform MATLAB operations on it (e.g. gradient expects type double). How do I get around this?

Thanks,

Alex

You have to follow CVX’s rules; otherwise you will have to use something other than CVX. The rules for what you can do inside myfun are the same as if the operations were done in the main body of your CVX program. Please read “New functions via the DCP ruleset” http://cvxr.com/cvx/doc/advanced.html#new-functions-via-the-dcp-ruleset