浅谈压缩感知(三十二):压缩感知的常见测量矩阵

一、参考文献中常见的测量矩阵

[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即可。

  1. function [ Phi ] = GaussMtx( M,N )  
  2. %GaussMtx Summary of this function goes here  
  3. %   Generate Bernoulli matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The Gauss matrix  
  7. %% Generate Gauss matrix     
  8.     Phi = randn(M,N);  
  9.     %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函数代替,后面若用到此函数则一样要注意这一点。

  1. function [ Phi ] = BernoulliMtx( M,N )  
  2. %BernoulliMtx Summary of this function goes here  
  3. %   Generate Bernoulli matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The Bernoulli matrix  
  7. %% (1)Generate Bernoulli matrix(The first kind)  
  8. % 1--P=0.5   -1--P=0.5  
  9.     Phi = randi([0,1],M,N);%If your MATLAB version is too low,please use randint instead  
  10.     Phi(Phi==0) = -1;  
  11.     %Phi = Phi/sqrt(M);  
  12. % %% (2)Generate Bernoulli matrix(The second kind)  
  13. % % 1--P=1/6   -1--P=1/6  0--2/3  
  14. %     Phi = randi([-1,4],M,N);%If your MATLAB version is too low,please use randint instead  
  15. %     Phi(Phi==2) = 0;%P=1/6  
  16. %     Phi(Phi==3) = 0;%P=1/6  
  17. %     Phi(Phi==4) = 0;%P=1/6  
  18. %     %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文件。

  1. function [ Phi ] = PartHadamardMtx( M,N )  
  2. %PartHadamardMtx Summary of this function goes here  
  3. %   Generate part Hadamard matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The part Hadamard matrix  
  7. %% parameter initialization  
  8. %Because the MATLAB function hadamard handles only the cases where n, n/12,  
  9. %or n/20 is a power of 2  
  10.     L_t = max(M,N);%Maybe L_t does not meet requirement of function hadamard  
  11.     L_t1 = (12 - mod(L_t,12)) + L_t;  
  12.     L_t2 = (20 - mod(L_t,20)) + L_t;   
  13.     L_t3 = 2^ceil(log2(L_t));  
  14.     L = min([L_t1,L_t2,L_t3]);%Get the minimum L  
  15. %% Generate part Hadamard matrix     
  16.     Phi = [];  
  17.     Phi_t = hadamard(L);  
  18.     RowIndex = randperm(L);  
  19.     Phi_t_r = Phi_t(RowIndex(1:M),:);  
  20.     ColIndex = randperm(L);  
  21.     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范数(各项平方之和再开方),这里采用后者。

  1. function [ Phi ] = PartFourierMtx( M,N )  
  2. %PartFourierMtx Summary of this function goes here  
  3. %   Generate part Fourier matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The part Fourier matrix  
  7. %% Generate part Fourier matrix     
  8.     Phi_t = fft(eye(N,N))/sqrt(N);%Fourier matrix  
  9.     RowIndex = randperm(N);  
  10.     Phi = Phi_t(RowIndex(1:M),:);%Select M rows randomly  
  11.     %normalization  
  12.     for ii = 1:N  
  13.         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

浅谈压缩感知(三十二):压缩感知的常见测量矩阵

  1. function [ Phi ] = SparseRandomMtx( M,N,d )  
  2. %SparseRandomMtx Summary of this function goes here  
  3. %   Generate SparseRandom matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   d -- The number of '1' in every column,d<M   
  7. %   Phi -- The SparseRandom matrix  
  8. %% Generate SparseRandom matrix     
  9.     Phi = zeros(M,N);  
  10.     for ii = 1:N  
  11.         ColIdx = randperm(M);  
  12.         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行。

  1. function [ Phi ] = ToeplitzMtx( M,N )  
  2. %ToeplitzMtx Summary of this function goes here  
  3. %   Generate Toeplitz matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The Toeplitz matrix  
  7. %% Generate a random vector  
  8. %     %(1)Gauss  
  9. %     u = randn(1,2*N-1);  
  10.     %(2)Bernoulli  
  11.     u = randi([0,1],1,2*N-1);  
  12.     u(u==0) = -1;  
  13. %% Generate Toeplitz matrix     
  14.     Phi_t = toeplitz(u(N:end),fliplr(u(1:N)));  
  15.     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自带函数生成。

  1. function [ Phi ] = CirculantMtx( M,N )  
  2. %CirculantMtx Summary of this function goes here  
  3. %   Generate Circulant matrix   
  4. %   M -- RowNumber  
  5. %   N -- ColumnNumber  
  6. %   Phi -- The Circulant matrix  
  7. %% Generate a random vector  
  8. %     %(1)Gauss  
  9. %     u = randn(1,N);  
  10.     %(2)Bernoulli  
  11.     u = randi([0,1],1,N);  
  12.     u(u==0) = -1;  
  13. %% Generate Circulant matrix     
  14.     Phi_t = toeplitz(circshift(u,[1,1]),fliplr(u(1:N)));  
  15.     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函数的两个输入参数好好体会即可。