資源簡介
SOMP是壓縮感知中的子空間重構(gòu)算法,包含一個源碼和一篇SOMP文章。
代碼片段和文件信息
%?已知?A?和?y(=Ax)?求?x
%?聯(lián)系方式:sy1133@163.com
%===========================================
clear;?clc
n?=?500;?%?信號長度
m?=?100;?%?測量次數(shù)?
k?=?20;??%?稀疏度
%Generate?sparse?signal?
z?=?randperm(n);
x?=?zeros(n?1);
x(z(1:k))?=?sign(randn(k1));
A?=?randn(mn);?%?用于重構(gòu)的高斯隨機矩陣
y?=?A*x;????????%?投影信息:y
alpha?=?1;?%?如果alpha取2就是CoSaMP算法
r?=?y;?L?=?[];?a_index=[];a_index2=[];
a?=?zeros(size(x));
iter?=?1;
err?=?1e-5;?%?信號誤差
tic
while?(iter?20*k?&&?norm(r)>err)
????
????%?Identify
????h?=?A‘*?r;
????[h_newh_index]?=?sort(abs(h)‘descend‘);
????
????%?Merge
????L?=?union(a_index2h_index(1:alpha*k));
????
????%?Estimate
????a(L)?=?A(:L)\y;??
????
????%Prune?
????[a_newa_index]?=?sort(abs(a)‘descend‘);
????a(a_index(k+1:end))=0;?
????a_index2?=?a_index(1:k);
????
????%?Iterate
????r=?y?-?A*a;?%?r=y-A(:a_index2)*pinv(A(:a_index2))*y;
????iter?=?iter?+?1;
????
end
toc
disp(norm(r))
disp(iter)
stem(x‘Linestyle‘‘none‘)??%原始信號,籃圈
hold?on
stem(a‘r‘‘.‘‘Linestyle‘‘none‘)???%重構(gòu)后的信號,紅點
title(‘recover‘)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-05-03?14:03??SP算法加文章\
?????文件????????1135??2011-03-10?11:13??SP算法加文章\Somp.m
?????文件??????455354??2010-12-18?09:25??SP算法加文章\Somp.pdf
評論
共有 條評論