资源简介
l1-Magic MATLAB凸优化工具箱
代码片段和文件信息
% l1eq_example.m
%
% Test out l1eq code (l1 minimization with equality constraints).
%
% Written by: Justin Romberg Caltech
% Email: jrom@acm.caltech.edu
% Created: October 2005
%
% put key subdirectories in path if not already there
path(path ‘./Optimization‘);
path(path ‘./Data‘);
% load random states for repeatable experiments
load RandomStates
rand(‘state‘ rand_state);
randn(‘state‘ randn_state);
% signal length
N = 256;
% number of spikes in the signal
T=20;
% number of observations to make
K = 100;
%Pamameter
%epson=0.1;
lamda=4;
% random +/- 1 signal
x = zeros(N1);
q = randperm(N);
%x(q(1:T)) = sign(randn(T1));
x(q(1:T)) = randn(T1);
% measurement matrix
disp(‘Creating measurment matrix...‘);
A = randn(KN);
A = orth(A‘)‘;
disp(‘Done.‘);
% observations
y = A*x;
% initial guess = min energy
x0 = A‘*y;
% solve the LP
tic
xpp = l1eq_pd(x0 A [] y 1e-3);
%%Reweighted Iterations m=10
X=x0;
t=0;
for k=1:10
for m=1:8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
XX=sort(abs(X)‘descend‘);
epson=max(0.001XX(25));%Adaptive Choice of epson
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w=zeros(N1);
W=[];
for i=1:N
w(i)=1/(X(i)^2+epson^2);% Penalty Function=actan(|x|/epson)
%w(i)=2*lamda*exp(-lamda*X(i))/(1+exp(-lamda*X(i)))^2;
end
W=diag(w);
xp=l1eq_pd(XA*inv(W)[]y1e-3);
X=inv(W)*xp;
%plot(xX‘g*‘)
end
wucha =max(abs(X-x));
if wucha<1.0e-3
t=t+1;
end
end
%%
toc
Ratio=t/10
figure(1)
subplot(131)
stem(x‘k.‘) % 原始信号
subplot(132)
stem(xpp‘*‘) % 重构信号
subplot(133)
stem(X‘b*‘) % 加权重构信号
wucha =max(abs(xpp-x))
Rwucha=max(abs(X-x))
%legend(‘Recovery‘‘Original‘)
SNR=20*log(norm(x)/norm(x-xpp))
RSNR=20*log(norm(x)/norm(x-X))
%result=[wucha SNR;Rwucha RSNR]
% large scale
% Afun = @(z) A*z;
% Atfun = @(z) A‘*z;
% tic
% xp = l1eq_pd(x0 Afun Atfun y 1e-3 30 1e-8 200);
% toc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1971 2011-05-25 22:42 L1_Magic\AdaptiveRW.m
文件 0 2010-12-27 00:02 L1_Magic\b.m
文件 90 2010-12-30 12:33 L1_Magic\fig.m
文件 1905 2011-01-05 00:11 L1_Magic\huatu.m
文件 1339 2010-12-26 22:18 L1_Magic\l1dantzig_example.m
文件 640 2005-11-16 14:48 L1_Magic\l1decode_example.m
文件 1858 2011-01-05 00:28 L1_Magic\l1eq_example.m
文件 1583 2010-12-27 22:53 L1_Magic\l1qc_example.m
文件 2673 2011-01-09 00:57 L1_Magic\RWl1eq_example.m
文件 2644 2011-01-09 01:24 L1_Magic\RWRWl1eq_example.m
文件 534 2011-01-03 22:15 L1_Magic\shuju.m
文件 210 2011-01-03 16:05 L1_Magic\SigmoidRW.m
文件 2724 2011-08-30 14:17 L1_Magic\SRWl1eq_example.m
文件 1710 2010-12-18 21:17 L1_Magic\tv.m
文件 1720 2010-12-18 21:20 L1_Magic\tvdantzig_example.m
文件 1396 2005-11-08 01:23 L1_Magic\tveq_example.m
文件 867 2005-11-22 07:31 L1_Magic\tveq_phantom_example.m
文件 1424 2005-11-04 09:42 L1_Magic\tvqc_example.m
文件 1405 2005-11-04 11:28 L1_Magic\tvqc_quantization_example.m
文件 82 2007-04-06 01:29 L1_Magic\Optimization\._l1eq_pd.m
文件 82 2007-04-06 01:30 L1_Magic\Optimization\._l1qc_logbarrier.m
文件 82 2007-04-06 01:31 L1_Magic\Optimization\._tveq_logbarrier.m
文件 1691 2006-05-27 03:14 L1_Magic\Optimization\cgsolve.m
文件 6021 2012-04-13 23:53 L1_Magic\Optimization\l1dantzig_pd.m
文件 4844 2006-02-23 02:30 L1_Magic\Optimization\l1decode_pd.m
文件 5370 2009-11-07 21:56 L1_Magic\Optimization\l1eq_pd.m
文件 2763 2007-04-06 01:30 L1_Magic\Optimization\l1qc_logbarrier.m
文件 4179 2005-11-04 05:11 L1_Magic\Optimization\l1qc_newton.m
文件 2917 2010-05-26 12:20 L1_Magic\Optimization\tvdantzig_logbarrier.m
文件 5990 2010-05-27 13:02 L1_Magic\Optimization\tvdantzig_newton.m
............此处省略19个文件信息
- 上一篇:hough变换matlab程序
- 下一篇:基于matlab的数字电子琴的完全指导手册
评论
共有 条评论