Skip to content

Commit 88ee27b

Browse files
authored
Add files via upload
1 parent 357045d commit 88ee27b

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

MATLAB/AMP.m

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function xhat=AMP(y,H,landa,iterAMP,m,n)
2+
%% y is measurement vector; H is measurement matrix, iterAMP is number of iterations, m and n are matrix dimentions
3+
r=y;
4+
s=zeros(n,1);
5+
sqM=sqrt(m);
6+
7+
for t=1:iterAMP
8+
9+
maxs=sort(abs(r),'descend');
10+
sigma=mean(maxs(1:20));%norm(r)/sqM;
11+
g=H'*r;
12+
s=s+g;
13+
14+
%minOFmaxs=mean(maxs(1:10));
15+
for i=1:n
16+
s(i)=sign(s(i))*max(abs(s(i))-sigma,0);
17+
end
18+
%for i=1:n %thresholding
19+
% a=middle(i);
20+
% s(i)=sign(a)*max(abs(a)-sigma,0);
21+
%end
22+
b=sum(abs(s)>0)/m;
23+
r=y-H*s+b.*r;
24+
end
25+
xhat=s;
26+
end

MATLAB/IHT_Mine.m

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function x=IHT_Mine(y,A,k,iteration)
2+
[M,N]=size(A);
3+
xnew=zeros(N,1);
4+
r=y-A*xnew;
5+
for i=1:iteration
6+
g=A'*(r);
7+
w=0.001;%(g'*g)/(g'*(A'*A)*g);
8+
x=xnew+w*g;
9+
[v,s]=sort(abs(x),'descend');
10+
T=s(1:k);
11+
xnew(:)=0;
12+
xnew(T)=x(T);
13+
r=y-A*xnew;
14+
end
15+
x=xnew;
16+
end

MATLAB/OMP.m

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function [ s_hat ] = OMP(x,A,q)
2+
[N,K] = size(A);
3+
s_hat= zeros(K,1);
4+
r=x;
5+
T=[];
6+
for i=1:K
7+
norms(i)=norm(A(:,i));
8+
end
9+
for ii = 1:q
10+
g= A'*r;
11+
for b3=1:K
12+
f(b3)=abs(g(b3))/norms(b3);
13+
end
14+
jj = find(f == max(f));
15+
T = union(T,jj);
16+
s_hat(T)=pinv(A(:,T)) * x; %%coeffecient update
17+
r=x-A*s_hat; %%residu update
18+
if (mse(x,s_hat) < .1)
19+
break;
20+
end
21+
end
22+
23+
24+

0 commit comments

Comments
 (0)