aboutsummaryrefslogtreecommitdiff
path: root/l1decode_example.m
diff options
context:
space:
mode:
Diffstat (limited to 'l1decode_example.m')
-rw-r--r--l1decode_example.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/l1decode_example.m b/l1decode_example.m
new file mode 100644
index 0000000..dd93302
--- /dev/null
+++ b/l1decode_example.m
@@ -0,0 +1,42 @@
+% l1decode_example.m
+%
+% Test out l1decode code.
+%
+% Written by: Justin Romberg, Caltech
+% Email: jrom@acm.caltech.edu
+% Created: October 2005
+%
+
+path(path, './Optimization');
+
+% source length
+N = 256;
+
+% codeword length
+M = 4*N;
+
+% number of perturbations
+T = round(.2*M);
+
+% coding matrix
+G = randn(M,N);
+
+% source word
+x = randn(N,1);
+
+% code word
+c = G*x;
+
+% channel: perturb T randomly chosen entries
+q = randperm(M);
+y = c;
+y(q(1:T)) = randn(T,1);
+
+% recover
+x0 = inv(G'*G)*G'*y;
+xp = l1decode_pd(x0, G, [], y, 1e-4, 30);
+
+% large scale
+% gfun = @(z) G*z;
+% gtfun = @(z) G'*z;
+% xp = l1decode_pd(x0, gfun, gtfun, y, 1e-3, 25, 1e-8, 200);