Mad function erorr

Hi, I am not sure what wrong with this code? Can I directly use mad function in CVX?

Target = 1.06;
delta = 0.3;
for k = 1:length(Target)
cvx_begin quiet
variables t z(10) x(4);
minimize(prob*(z+t)+ delta*mad(z+t));
subject to
z + t + B * ret x >= L;
z + t >= 0;
z >= 0;
mu
x >= Target;
ones(1,4)*x == 1;
x >= 0;
cvx_end
end

erorr:
z = x.id_ == y.id_;
if isequal(x,[]), y = nan(‘like’,x); return; end
minimize(prob*(z+t)+ delta*mad(z+t));

All the supported functions are listed in the CVX Users’ Guide. mad is not among them.

Before trying to reformulate for CVX, make sure the problem is convex, which is your responsibility.

Anyhow, I think this is what you want:
sum(abs(z-sum(z)/10))/10 or norm(z-sum(z)/10,1)/10

I believe mean(z) should be allowed, but I am getting an error message. But the preceding should work.