• 大小: 112KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-19
  • 语言: Matlab
  • 标签: CS  压缩传感  matlab  

资源简介

陆吾生教授2010年压缩感知课程配套的matlab代码

资源截图

代码片段和文件信息

% Program: ex3_1.m
% To implement the ISTA algorithm to the problem in Example 3.1 
% (see pap. 36 - 38 of the notes).
% Input:
% m: number of rows (measurements) in matrix A.
% sig: standard deviation of noise w.
% lam: parameter \lambda.
% itrs: number of iterations to be performed.
% st1: initial randon state for random permutation of index {1 2 ... n}
% st2: initial random state for measurement noise w.
% Output:
% x: original signal.
% xh: reconstructed signal.
% err: relative reconstruction error.
% Written by W.-S. Lu University of Victoria.
% Example: [xxherr] = ex3_1(3800.20.3534157);
function [xxherr] = ex3_1(msiglamitrsst1st2)
% Prepare a signal x who is sparse in DCT domain
n = 1024;
dt = 1/2000;
T = 1023*dt;
t = 0:dt:T;
t = t(:);
x = sin(697*pi*t) + sin(1975*pi*t);
Dn = gen_dct(n); 
% Get measurements
rand(‘state‘st1)
q = randperm(n);
q = q(:);
y = x(q(1:m));
randn(‘state‘st2)
w = sig*randn(m1);
yn = y + w;
Psi1 = Dn‘;
% Reconstruction of signal x by l1-minimization
A = Psi1(q(1:m):);
tmax = 1/max(eig(A*A‘));
tt = 0.95*tmax;
% thk = A‘*yn;
thk = zeros(n1);
alp = lam*tt;
for i = 1:itrs
  ck = thk - 2*tt*A‘*(A*thk-yn);
  thk = (max(abs(ck)-alp0)).*sign(ck);
end
xh = Psi1*thk;
err = norm(x-xh)/norm(x);
figure(1)
subplot(121)
plot(tx)
title(‘DCT-sparse signal‘)
xlabel(‘(a)‘)
axis([0 T -2.5 2.5])
grid
subplot(122)
plot(txh)
title(‘reconstructed‘)
xlabel(‘(b)‘)
axis([0 T -2.5 2.5])
grid
figure(2)
t1 = 50*dt:dt:100*dt;
plot(t1x(50:100)‘b‘t1xh(50:100)‘r‘‘linewidth‘ 1.5);
grid
xlabel(‘time‘)
title(‘51 samples of original (blue) vs reconstructed (red) with 380 noisy samples‘)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-11-18 10:33  matlab_program\
     文件       49437  2005-11-18 14:55  matlab_program\camera256.mat
     文件        1704  2010-11-16 06:53  matlab_program\ex3_1.m
     文件        1812  2010-11-16 06:53  matlab_program\ex3_2.m
     文件        2077  2010-11-16 07:47  matlab_program\fgp_denoise.m
     文件         442  2010-11-16 06:54  matlab_program\gen_dct.m
     文件        2173  2010-11-16 07:51  matlab_program\gp_deblurr.m
     文件        1811  2010-11-16 07:48  matlab_program\gp_denoise.m
     文件         550  2010-11-16 07:34  matlab_program\gp_denoise_w.m
     文件       56686  2010-11-08 03:27  matlab_program\lena256.mat
     文件         315  2010-11-16 07:20  matlab_program\oper_L.m
     文件         237  2010-11-16 07:19  matlab_program\oper_Lt.m
     文件         227  2010-11-16 07:16  matlab_program\proj_bound.m
     文件         437  2010-11-16 07:13  matlab_program\proj_pair.m

评论

共有 条评论