Minimizing the following SVM formulation \begin{align} \arg\min_{\mathbf{w}}\frac{1}{2}\|\mathbf{w}\|^2_2 \\ \text{subject to } \quad y_i(\mathbf{w}\cdot\mathbf{x_i}) \ge 1 \end{align} can be done quite easily in MATLAB:
%% problem setup
n = 200;
d = 2;
X = mvnrnd(5*ones(d,1),0.3*eye(d),n/2);
y = ones(size(X,1),1);
X = [X; -X];
y = [y; -y];
%% algorithm
[n,d] = size(X);
H = diag(ones(d,1));
f = zeros(d,1);
A = diag(-y)*X;
b = -ones(n,1);
w = quadprog(H,f,A,b);
where $X$ is a matrix of $x_i$ and $y$ a vector containing $y_i$, $n$ being the number of samples and $d$ the dimension.
I am looking for an example to minimize the L1 regularized version in MATLAB:
\begin{align}
\arg\min_{\mathbf{w}}\frac{1}{2}\|\mathbf{w}\|_1 \\
\text{subject to } \quad y_i(\mathbf{w}\cdot\mathbf{x_i}) \ge 1
\end{align}
Is there a way to do it (maybe with linprog)?
If you're willing to use my toolbox CVX, then it's as simple as this:
But yes, fabee's comment is a valid option as well; he should promote it to an answer so it can be voted up.