I have a L1 minimization problem. I was trying to do it using CVX. In Matlab I have

function [ev,x] = L1minimizationV3( A, b, gamma )

% Computes x such that it minimizes the quantity norm(Ax-b,1).

% Uses slack variables

[m,n]=size(A);

lb=[zeros(n,1);zeros(n,1); zeros(2*m,1)];

I = eye(m);

Aeq = [A,-A,-I,I];

f=[ones(2*n,1);gamma*ones(2*m,1)];
options = optimoptions(‘linprog’,‘Algorithm’,‘dual-simplex’,‘OptimalityTolerance’,1e-10);
xps = linprog(f,[],[],Aeq,b,lb,[],options);
x=xps(1:2*n);

ev=xps(1:n)-xps(n+1:2*n);

end

I was going to attempt this as

function L1minizationV4(A, b, gamma)

%

%

[m,n]=size(A);

lb=[zeros(n,1);zeros(n,1); zeros(2*m,1)];

I = eye(m);

Aeq = [A,-A,-I,I];

f=[ones(2*n,1);gamma*ones(2*m,1)];

cvx_begin

variable x(n)

dual variable y;

minimize ( f’*x);

subject to y: A * x == b

cvx_end

I am not sure about the rest of the constraints.