-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathOMP_delta.m
38 lines (38 loc) · 1.16 KB
/
OMP_delta.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [x, t, Pos_h_t] = OMP_delta(Q, y, sigma, noise_en, Lp)
% OMP Algorithm
[M, N] = size(Q);
h_temp = zeros(N,1);
Pos_h_t = [];
r_n = y;
Q_t = [];
t = 0;
ht_LS = [];
if(nargin == 3 || noise_en)
delta = sigma^2;
while(r_n'*r_n > size(y,1)*delta)
product_t = Q'*r_n;
[~, pos_t] = max(abs(product_t));
Pos_h_t = [Pos_h_t pos_t]; %Qt相当于At,Pos_h_t相当于配置集合倒Vt
Q_t = [Q_t,Q(:,pos_t)];
Q(:,pos_t) = zeros(M,1);
ht_LS = Q_t\y; %%%%为什么没有乘dft矩阵,ht_LS 相当于theta Q_t\y是最小二乘解吗?好像不是,直接除
r_n = y - Q_t*ht_LS;
t = t+1;
end
h_temp(Pos_h_t) = ht_LS;
x = h_temp;
else
while(t < Lp)
product_t = Q'*r_n;
[~, pos_t] = max(abs(product_t));
Pos_h_t = [Pos_h_t pos_t];
Q_t = [Q_t,Q(:,pos_t)];
Q(:,pos_t) = zeros(M,1);
ht_LS = Q_t\y;
r_n = y - Q_t*ht_LS;
t = t+1;
end
h_temp(Pos_h_t) = ht_LS;
x = h_temp;
end
end