clear all;
close all;

d=[350; 340; 450; 650; 650; 550; 700; 670; 350; 450; 400; 650];

cvx_begin
variables x(12) s(13);
u=[0; x(1:11)];
minimize (50*norm(x-u,1)+20*sum(s))
subject to
s(1)==0;
s(13)==0;
s>=0;
x+s(1:12)-s(2:13)==d;
cvx_end