5;
<span class="comment">% add some outliers</span>
x = [x' 0.1 0.5 0.9]';
k =  -5;
y = [y' k  k k]';

n = length(x);
Xtrain = x(:);
modelLS = linregFit(Xtrain, y, <span class="string">'lambda'</span>, 0);<span class="comment">% least squares soln</span>
xs = 0:0.1:1;
Xtest = xs(:);
yhatLS = linregPredict(modelLS, Xtest);
</pre><h2>Laplace loss<a name="3"></a></h2><pre class="codeinput">modelLP = linregRobustLaplaceFitLinprog(Xtrain, y);
yhatLaplace = linregPredict(modelLP, Xtest);
</pre><pre class="codeout