您的位置:首页 > 编程语言 > MATLAB

压缩感知中常用的观测矩阵

2014-05-12 11:24 204 查看
接上文:《压缩感知中常用的待还原信号种类》,http://blog.csdn.net/zhyoulun/article/details/25600311

在压缩感知中,观测矩阵就是指y=Ax中的A。A是一个n*m的矩阵,矩阵中的每一个元素独立同分布于一个特定的分布。分布的种类如下:
1、USE。一致球集合,Uniform spherical ensemble,首先计算出一个n*m的矩阵,矩阵中的每一个元素服从标准正态分布,然后对这个矩阵的每一列做归一化。
2、RSE。随机信号集合,Random signs ensemble,首先计算出一个n*m的矩阵,矩阵中的每一个元素服从伯努利+/-1分布,然后对这个矩阵的每一列做归一化。
3、Fourier。局部傅里叶集合,Partial Fourier ensemble,首先计算出一个m*m的傅里叶矩阵,随机取n行,最后对列进行归一化。
4、RST。局部实傅里叶集合,Partial RST (Real Fourier) ensemble.同“Fourier”的情况。
5、Hadamard。局部哈达玛集合,Partial Hadamard ensemble. 首先计算出一个m*m的哈达玛矩阵,随机取n行,最后对列进行归一化。
6、URP。一致随机投影集合,Uniform Random Projection ensemble. 首先产生一个m*m的正交矩阵,然后随机取出n行。
7、IR。单位矩阵和随机正交基,Identity and Random otho-basis. 将一个n*n的单位矩阵和一个n*n的随机正交基连接起来,产生一个n*2n的矩阵。

SparseLab2.1-Core\Utilities\BuildDatasets\MatrixEnsemble.m
附代码
function Phi = MatrixEnsemble(n,m,ensemble)
% MatrixEnsemble: Generates a random matrix of size n by m.
%
% Usage:
% Phi = MatrixEnsemble(n,m,ensemble)
% Inputs:
% n number of rows
% m number of columns
% ensemble string containing name of matrix ensemble:
% 'USE', 'RSE', 'Fourier', 'RST', 'Hadamard', 'URP', 'IR'.
% Default is 'USE'.
% Outputs:
% Phi n by m matrix from the specified ensemble
% Description:
% This function creates a matrix from the specified random matrix
% ensemble. The following random ensembles are implemented:
%
% 'USE' - Uniform spherical ensemble. Columns are n-vectors,
% uniformly distributed on the sphere S^{n-1} (default).
%
% 'RSE' - Random signs ensemble. Entries in the matrix are
% chosen from a bernoulli +/-1 distribution, and columns are
% normalized to have unit euclidean length.
%
% 'Fourier' - Partial Fourier ensemble. Matrices in this ensemble
% are generated by taking the m by m Fourier matrix, sampling
% n rows at random, and scaling columns to have unit euclidean length.
%
% 'RST' - Partial RST (Real Fourier) ensemble. See 'Fourier' above.
%
% 'Hadamard' - Partial Hadamard ensemble. Matrices in this ensemble
% are generated by taking the m by m Hadamard matrix, sampling
% n rows at random, and scaling columns to have unit euclidean length.
%
% 'URP' - Uniform Random Projection ensemble. Matrices in this
% ensemble are generated by sampling n rows of an m by m
% random orthogonal matrix.
%
% 'IR' - Identity and Random otho-basis. An n by 2n matrix is
% constructed, as the concatenation of the n by n identity and
% an n x n random ortho-basis.
%
% See Also
% SparseVector

if nargin < 3,
ensemble = 'USE';
end

switch upper(ensemble)
case 'USE'
Phi = randn(n,m);

% Normalize the columns of Phi
for j = 1:m
Phi(:,j) = Phi(:,j) ./ twonorm(Phi(:,j));
end

case 'RSE'
Phi = sign(rand([n m]) - 0.5);
zz = find(Phi == 0);
Phi(zz) = ones(size(zz));

% Normalize the columns of Phi
for ii = 1:size(Phi,2)
Phi(:,ii) = Phi(:,ii) ./ twonorm(Phi(:,ii));
end

case 'HADAMARD'
H = hadamard(m);
p = randperm(m);
Phi = H(p(1:n), :);

% Normalize the columns of Phi
for ii = 1:size(Phi,2)
Phi(:,ii) = Phi(:,ii) ./ twonorm(Phi(:,ii));
end

case 'FOURIER'
H = FourierMat(m);
p = randperm(m);
Phi = H(p(1:n), :);

% Normalize the columns of Phi
for ii = 1:size(Phi,2)
Phi(:,ii) = Phi(:,ii) ./ twonorm(Phi(:,ii));
end

case 'RST'
H = RSTMat(m);
p = randperm(m);
Phi = H(p(1:n), :);

% Normalize the columns of Phi
for ii = 1:size(Phi,2)
Phi(:,ii) = Phi(:,ii) ./ twonorm(Phi(:,ii));
end

case 'URP'
[U,S,V] = svd(rand(n,m),'econ');
Phi = V';

% Normalize the columns of Phi
for ii = 1:size(Phi,2)
Phi(:,ii) = Phi(:,ii) ./ twonorm(Phi(:,ii));
end

case 'IR'
[Q,R] = qr(rand(n));
Phi = [eye(n) Q];

end%
% Part of SparseLab Version:100
% Created Tuesday March 28, 2006
% This is Copyrighted Material
% For Copying permissions see COPYING.m
% Comments? e-mail sparselab@stanford.edu
%


运行示例:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息