% l1eq example using linprog
% (l1 minimization with equality constraints).
% (l1 minimization with equality constraints).
%%%%%%%%%%%%%%%%%%%%%%%%
% Problem definition
% minimise t(1) + ... + t(n)
% subject to A*x = b
% -x - t <= 0
% x - t <= 0
%%%%%%%%%%%%%%%%%%%%%%%%
% Problem definition
% minimise t(1) + ... + t(n)
% subject to A*x = b
% -x - t <= 0
% x - t <= 0
%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
% signal length
N = 512;
% number of spikes in the signal
T = 20;
% number of observations to make
K = 120;
% random +/- 1 signal
x = zeros(N,1);
q = randperm(N);
x(q(1:T)) = sign(randn(T,1));
% measurement matrix
disp('Creating measurment matrix...');
A = randn(K,N);
A = orth(A')';
disp('Done.');
% observations
y = A*x;
% initial guess = min energy
x0 = A'*y;
% solve the LP
tic
[m, n] = size(A);
f = [zeros(n, 1); ones(n, 1)];
Ai = [-eye(n), -eye(n); eye(n), -eye(n)];
bi = zeros(2*n, 1);
Aeq = [A, zeros(m, n)];
beq = y;
xp = linprog(f, Ai, bi, Aeq, beq);
xp = xp(1:n);
N = 512;
% number of spikes in the signal
T = 20;
% number of observations to make
K = 120;
% random +/- 1 signal
x = zeros(N,1);
q = randperm(N);
x(q(1:T)) = sign(randn(T,1));
% measurement matrix
disp('Creating measurment matrix...');
A = randn(K,N);
A = orth(A')';
disp('Done.');
% observations
y = A*x;
% initial guess = min energy
x0 = A'*y;
% solve the LP
tic
[m, n] = size(A);
f = [zeros(n, 1); ones(n, 1)];
Ai = [-eye(n), -eye(n); eye(n), -eye(n)];
bi = zeros(2*n, 1);
Aeq = [A, zeros(m, n)];
beq = y;
xp = linprog(f, Ai, bi, Aeq, beq);
xp = xp(1:n);
toc
% Quality of reconstruction, difference between x an xp using l2
1 comment:
microtouch solo titanium - A beginner's miniaturized miniaturized
Learn how microtouch solo titanium works to maximize the power of your columbia titanium boots smartphone or gaming mens titanium rings device. mens titanium rings Learn how to mens titanium necklace install titanium blade microtouch
Post a Comment