当前位置:网站首页>Common sparse basis and matlab code for compressed sensing
Common sparse basis and matlab code for compressed sensing
2022-07-29 00:35:00 【Love learning one by one】
List of articles
Preface
The first step of compressed sensing is the sparse representation of the signal , So it is particularly important to find sparse bases , This blog will introduce the commonly used sparse basis and its matlab Code .
One 、 What is a sparse base ?
Sparse basis is a matrix that can sparse represent signals . Let one-dimensional discrete signal x x x, The length is N N N, Can be seen as N N N Dimensional space N × 1 N \times1 N×1 The column vector , If this column vector contains K K K It's not for 0 Elements , And K < < N K < < N K<<N, The signal x x x yes K K K- Sparse signal , Have sparsity .
If the signal is sparse , Then signal x x x It can be expressed as : x = Ψ s x=\varPsi s x=Ψs among , Ψ \varPsi Ψ Sparse basis ( sparse matrix ).
Two 、 Some commonly used sparse bases
1、DFT( Discrete Fourier ) Sparse basis
%%matlab Built-in function
dftmtx(N)/sqrt(N);
%% Equivalent to the above
fft(eye(N))/sqrt(N);
2、DCT( Discrete cosine ) Sparse basis
%% matlab Built-in function
dctmtx(N);
%% Expand and write as :
[cc,rr] = meshgrid(0:n-1);
c = sqrt(2 / n) * cos(pi * (2*cc + 1) .* rr / (2 * n));
c(1,:) = c(1,:) / sqrt(2);
3、DWT( wavelet ) Sparse basis
function ww=DWT(N)
[h,g]= wfilters('sym8','d'); % Decompose low-pass and high pass filters
% N=256; % Matrix dimension ( The size is 2 Integer power of )
L=length(h); % Filter length
rank_max=log2(N); % Maximum number of layers
rank_min=double(int8(log2(L)))+1; % Minimum number of layers
ww=1; % Preprocessing matrix
% Matrix construction
for jj=rank_min:rank_max
nn=2^jj;
% Construct vectors
p1_0=sparse([h,zeros(1,nn-L)]);
p2_0=sparse([g,zeros(1,nn-L)]);
% Vector circumferential shift
for ii=1:nn/2
p1(ii,:)=circshift(p1_0',2*(ii-1))';
p2(ii,:)=circshift(p2_0',2*(ii-1))';
end
% Construct an orthogonal matrix
w1=[p1;p2];
mm=2^rank_max-length(w1);
w=sparse([w1,zeros(length(w1),mm);zeros(mm,length(w1)),eye(mm,mm)]);
ww=ww*w;
clear p1;clear p2;
end
The author of the program is Javert , Department of electrical and electronic engineering, University of Hong Kong ,[email protected]
4、0-1 Random sparse basis ( It is also reasonable according to the sparse characteristics )
%% Use rand Function generation 0-1 The number of intervals
function A=get01(N)
B=rand(N,N); % Will produce N That's ok N Column random number matrix
A=round(B); % Round the resulting matrix , You can get non 0 namely 1 Matrix
end
summary
The above is the content and code of the sparse base to be shown , If you have other commonly used sparse bases , Welcome to comment and share below ~
边栏推荐
- 1331. Array sequence number conversion: simple simulation question
- R语言怎么学
- NPM run serve stuck at 40%
- 2022dasctfjuly empowerment competition (reappearance)
- Advanced area of attack and defense world web masters unserialize3
- Dynamic programming (V)
- pnpm的安装与使用
- CV target detection model sketch (2)
- 12个MySQL慢查询的原因分析
- 110道 MySQL面试题及答案 (持续更新)
猜你喜欢

PTA (daily question) 7-71 character trapezoid

还在写大量 if 来判断?一个规则执行器干掉项目中所有的 if 判断...

PTA (daily question) 7-74 yesterday

Upload Excel files with El upload and download the returned files

Laravel permission control

MySQL installation and configuration tutorial (super detailed, nanny level)
![[applet project development -- JD mall] uni app commodity classification page (first)](/img/6c/5b92fc1f18d58e0fdf6f1896188fcd.png)
[applet project development -- JD mall] uni app commodity classification page (first)

动态规划问题(五)

MySQL transaction (this is enough...)

MySQL的存储过程
随机推荐
Longest ascending subsequence
1331. Array sequence number conversion: simple simulation question
@Detailed explanation of the use of transactional annotation
Do like and in indexes in MySQL go
Advanced area of attack and defense world web masters warmup
PTA (daily question) 7-74 yesterday
Html+css+php+mysql realize registration + login + change password (with complete code)
动态规划问题(三)
Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track
ES6 operation tutorial
Event extraction and documentation (2008-2017)
分布式限流 redission RRateLimiter 的使用及原理
递归/回溯刷题(下)
Recursion / backtracking (middle)
@PostConstruct注解详解
时间序列统计分析
Mock.js essay
vulnhub:Sar
Google browser, no installation required
15.模型评估和选择问题