浅谈压缩感知(三十二):压缩感知的常见测量矩阵
2017-12-28 18:06
211 查看
一、参考文献中常见的测量矩阵
[1]喻玲娟,谢晓春.压缩感知介绍[J].电视技术,2008,32(12):16-18.[2]李树涛,魏丹.压缩传感综述[J]. 自动化学报,2009,35(11):1369-1377.
[3]焦李成,杨淑媛,刘芳,侯彪. 压缩感知回顾与展望[J]. 电子学报,2011,39(7):1651-1662.
[4]石光明,刘丹华,高大化,刘哲,林杰,王良君. 压缩感知理论及其研究进展[J]. 电子学报,2009,37(5):1070-1081.
[5]李坤,马彩文,李艳,陈萍.压缩感知重构算法综述[J].红外与激光工程,2013,42(z1):225-232.
[6]党骙,马林华,田雨,张海威,茹乐,李小蓓. m序列压缩感知测量矩阵构造[J]. 西安电子科技大学(自然科学版),2015,42(2):215-222.
[7]朱志臻,周崇彬,刘发林,李滨兵,张志达. 用于压缩感知的二值化测量矩阵[J]. 微波学报,2014,30(2):79-83,96.
[8]王学伟,崔广伟,王琳,贾晓璐,聂伟.基于平衡Gold序列的压缩感知测量矩阵的构造[J]. 仪器仪表学报,2014,35(1):97-102.
[9]张波,刘郁林,王开.稀疏随机矩阵有限等矩性质分析[J]. 电子与信息学报,2014,36(1):169-174.
[10]王侠,王开,王青云,梁瑞宇,左加阔,赵力,邹采荣. 压缩感知中的确定性随机观测矩阵构造[J]. 信号处理,2014,30(4):436-442.
下面以文献【吴赟.压缩感知测量矩阵的研究[D]. 西安电子科技大学硕士学位论文,2012】为依据,给出文献中2.2节内容所述的六种测量矩阵MATLAB实现代码,仅为一种参考实现方式,还未验证其正确性。
以下代码生成的高斯矩阵方差为1,若为改为1/M,只须将除以根号M即可。
function [ Phi ] = GaussMtx( M,N )
%GaussMtx Summary of this function goes here
% Generate Bernoulli matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The Gauss matrix
%% Generate Gauss matrix
Phi = randn(M,N);
%Phi = Phi/sqrt(M);
function [ Phi ] = GaussMtx( M,N ) %GaussMtx Summary of this function goes here % Generate Bernoulli matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The Gauss matrix %% Generate Gauss matrix Phi = randn(M,N); %Phi = Phi/sqrt(M); end
以下代码是按式(2-8)生成的伯努利矩阵,若要按式(2-9)生成则需使用后半部分注释掉的代码即可。注意代码中用到了MATLAB自带的randi函数,若你的MATLAB版本较低,可能要用randint函数代替,后面若用到此函数则一样要注意这一点。
function [ Phi ] = BernoulliMtx( M,N )
%BernoulliMtx Summary of this function goes here
% Generate Bernoulli matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The Bernoulli matrix
%% (1)Generate Bernoulli matrix(The first kind)
% 1--P=0.5 -1--P=0.5
Phi = randi([0,1],M,N);%If your MATLAB version is too low,please use randint instead
Phi(Phi==0) = -1;
%Phi = Phi/sqrt(M);
% %% (2)Generate Bernoulli matrix(The second kind)
% % 1--P=1/6 -1--P=1/6 0--2/3
% Phi = randi([-1,4],M,N);%If your MATLAB version is too low,please use randint instead
% Phi(Phi==2) = 0;%P=1/6
% Phi(Phi==3) = 0;%P=1/6
% Phi(Phi==4) = 0;%P=1/6
% %Phi = Phi*sqrt(3/M);
function [ Phi ] = BernoulliMtx( M,N ) %BernoulliMtx Summary of this function goes here % Generate Bernoulli matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The Bernoulli matrix %% (1)Generate Bernoulli matrix(The first kind) % 1--P=0.5 -1--P=0.5 Phi = randi([0,1],M,N);%If your MATLAB version is too low,please use randint instead Phi(Phi==0) = -1; %Phi = Phi/sqrt(M); % %% (2)Generate Bernoulli matrix(The second kind) % % 1--P=1/6 -1--P=1/6 0--2/3 % Phi = randi([-1,4],M,N);%If your MATLAB version is too low,please use randint instead % Phi(Phi==2) = 0;%P=1/6 % Phi(Phi==3) = 0;%P=1/6 % Phi(Phi==4) = 0;%P=1/6 % %Phi = Phi*sqrt(3/M); end
由于MATLAB自带的函数hadamard参数有限制,所以程序中首先计算满足要求的参数L,需要注意的是,hadamard参数并不像文献中所述仅为2的整数次幂,而是12的整数倍或20的整数倍或2的整数次幂,详情在MATLAB查看hadamard的help文件。
function [ Phi ] = PartHadamardMtx( M,N )
%PartHadamardMtx Summary of this function goes here
% Generate part Hadamard matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The part Hadamard matrix
%% parameter initialization
%Because the MATLAB function hadamard handles only the cases where n, n/12,
%or n/20 is a power of 2
L_t = max(M,N);%Maybe L_t does not meet requirement of function hadamard
L_t1 = (12 - mod(L_t,12)) + L_t;
L_t2 = (20 - mod(L_t,20)) + L_t;
L_t3 = 2^ceil(log2(L_t));
L = min([L_t1,L_t2,L_t3]);%Get the minimum L
%% Generate part Hadamard matrix
Phi = [];
Phi_t = hadamard(L);
RowIndex = randperm(L);
Phi_t_r = Phi_t(RowIndex(1:M),:);
ColIndex = randperm(L);
Phi = Phi_t_r(:,ColIndex(1:N));
function [ Phi ] = PartHadamardMtx( M,N ) %PartHadamardMtx Summary of this function goes here % Generate part Hadamard matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The part Hadamard matrix %% parameter initialization %Because the MATLAB function hadamard handles only the cases where n, n/12, %or n/20 is a power of 2 L_t = max(M,N);%Maybe L_t does not meet requirement of function hadamard L_t1 = (12 - mod(L_t,12)) + L_t; L_t2 = (20 - mod(L_t,20)) + L_t; L_t3 = 2^ceil(log2(L_t)); L = min([L_t1,L_t2,L_t3]);%Get the minimum L %% Generate part Hadamard matrix Phi = []; Phi_t = hadamard(L); RowIndex = randperm(L); Phi_t_r = Phi_t(RowIndex(1:M),:); ColIndex = randperm(L); Phi = Phi_t_r(:,ColIndex(1:N)); end
以下代码生成的是部分傅里叶矩阵,这里要提的一点是,有关“归一化”的概念在网上说法不一,一种说法是向量除以向量各项之和,另一种说法是向量除以向量的2范数(各项平方之和再开方),这里采用后者。
function [ Phi ] = PartFourierMtx( M,N )
%PartFourierMtx Summary of this function goes here
% Generate part Fourier matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The part Fourier matrix
%% Generate part Fourier matrix
Phi_t = fft(eye(N,N))/sqrt(N);%Fourier matrix
RowIndex = randperm(N);
Phi = Phi_t(RowIndex(1:M),:);%Select M rows randomly
%normalization
for ii = 1:N
Phi(:,ii) = Phi(:,ii)/norm(Phi(:,ii));
function [ Phi ] = PartFourierMtx( M,N ) %PartFourierMtx Summary of this function goes here % Generate part Fourier matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The part Fourier matrix %% Generate part Fourier matrix Phi_t = fft(eye(N,N))/sqrt(N);%Fourier matrix RowIndex = randperm(N); Phi = Phi_t(RowIndex(1:M),:);%Select M rows randomly %normalization for ii = 1:N Phi(:,ii) = Phi(:,ii)/norm(Phi(:,ii)); end end
function [ Phi ] = SparseRandomMtx( M,N,d )
%SparseRandomMtx Summary of this function goes here
% Generate SparseRandom matrix
% M -- RowNumber
% N -- ColumnNumber
% d -- The number of '1' in every column,d<M
% Phi -- The SparseRandom matrix
%% Generate SparseRandom matrix
Phi = zeros(M,N);
for ii = 1:N
ColIdx = randperm(M);
Phi(ColIdx(1:d),ii) = 1;
function [ Phi ] = SparseRandomMtx( M,N,d ) %SparseRandomMtx Summary of this function goes here % Generate SparseRandom matrix % M -- RowNumber % N -- ColumnNumber % d -- The number of '1' in every column,d<M % Phi -- The SparseRandom matrix %% Generate SparseRandom matrix Phi = zeros(M,N); for ii = 1:N ColIdx = randperm(M); Phi(ColIdx(1:d),ii) = 1; end end
这里先给出托普利兹矩阵,文中说经过M次循环,这里直接利用MATLAB自带函数生成一个托普利兹方阵再取前M行。
function [ Phi ] = ToeplitzMtx( M,N )
%ToeplitzMtx Summary of this function goes here
% Generate Toeplitz matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The Toeplitz matrix
%% Generate a random vector
% %(1)Gauss
% u = randn(1,2*N-1);
%(2)Bernoulli
u = randi([0,1],1,2*N-1);
u(u==0) = -1;
%% Generate Toeplitz matrix
Phi_t = toeplitz(u(N:end),fliplr(u(1:N)));
Phi = Phi_t(1:M,:);
function [ Phi ] = ToeplitzMtx( M,N ) %ToeplitzMtx Summary of this function goes here % Generate Toeplitz matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The Toeplitz matrix %% Generate a random vector % %(1)Gauss % u = randn(1,2*N-1); %(2)Bernoulli u = randi([0,1],1,2*N-1); u(u==0) = -1; %% Generate Toeplitz matrix Phi_t = toeplitz(u(N:end),fliplr(u(1:N))); Phi = Phi_t(1:M,:); end
下面是循环矩阵,仍然利用MATLAB自带函数生成。
function [ Phi ] = CirculantMtx( M,N )
%CirculantMtx Summary of this function goes here
% Generate Circulant matrix
% M -- RowNumber
% N -- ColumnNumber
% Phi -- The Circulant matrix
%% Generate a random vector
% %(1)Gauss
% u = randn(1,N);
%(2)Bernoulli
u = randi([0,1],1,N);
u(u==0) = -1;
%% Generate Circulant matrix
Phi_t = toeplitz(circshift(u,[1,1]),fliplr(u(1:N)));
Phi = Phi_t(1:M,:);
function [ Phi ] = CirculantMtx( M,N ) %CirculantMtx Summary of this function goes here % Generate Circulant matrix % M -- RowNumber % N -- ColumnNumber % Phi -- The Circulant matrix %% Generate a random vector % %(1)Gauss % u = randn(1,N); %(2)Bernoulli u = randi([0,1],1,N); u(u==0) = -1; %% Generate Circulant matrix Phi_t = toeplitz(circshift(u,[1,1]),fliplr(u(1:N))); Phi = Phi_t(1:M,:); end
以上都是采用MATLAB自带的toeplitz函数,这需要首先生成一个随机向量,而托普利兹矩阵和循环矩阵的区别也就在于这个随机向量的结构不同,注意代码中有关toeplitz函数的两个输入参数好好体会即可。
相关文章推荐
- 压缩感知的常见测量矩阵
- 压缩感知中的常见测量矩阵及其MATLAB实现代码
- 压缩感知的常见测量矩阵
- 压缩感知测量矩阵的研究现状(转)
- 压缩感知测量矩阵构造方法研究
- 压缩感知测量矩阵之有限等距性质(Restricted Isometry Property, RIP)
- 压缩感知之测量矩阵研究现状
- 压缩感知测量矩阵之有限等距常数RIC的计算
- 压缩感知测量矩阵之如何评价一个测量矩阵的好坏?
- 压缩感知测量矩阵之spark常数
- 压缩感知中验证测量矩阵MM是否满足RIP性质
- 压缩感知先进——关于稀疏矩阵
- 浅谈压缩感知(二十五):压缩感知重构算法之分段正交匹配追踪(StOMP)
- 压缩感知中常用的观测矩阵
- 压缩感知进阶——有关稀疏矩阵
- 浅谈压缩感知(三):几何解释
- 压缩感知中的数学知识:投影矩阵(projection matrix)
- 压缩感知进阶——有关稀疏矩阵
- 浅谈压缩感知(二):理论基础
- 浅谈压缩感知(七):常见测量矩阵的MATLAB实现