-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_ASAP_Hankel_2D.m
More file actions
41 lines (34 loc) · 888 Bytes
/
test_ASAP_Hankel_2D.m
File metadata and controls
41 lines (34 loc) · 888 Bytes
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
39
40
41
clear all;
close all;
if exist('.\PROPACK', 'dir')==7
addpath PROPACK;
else
fprintf('No PROPACK installed.\n');
error('Break, PROPACK not installed');
end
n1 = 200; % signal size, first dimension
n2 = n1; % signal size, second dimension
r = 10; % rank
alpha = 0.1; % amount of corruptions
c = 1; % magnitude of corruptions
% Generate a 2D spectrally sparse signal
[~,ox,f] = generate_signal([n1 n2],r,n1*n2);
% Add corruptions
temp = rand(1,n1*n2);
IND = find(temp < alpha);
m = length(IND);
os = zeros(m,1);
a = c*mean(abs(real(ox)));
b = c*mean(abs(imag(ox)));
for i = 1:m
v1 = a-2*a*(1-rand(1));
v2 = b-2*b*(1-rand(1));
os(i) = v1+1i*v2;
end
z = ox;
z(IND) = ox(IND)+os;
z = reshape(z,[n1 n2]);
ox = reshape(ox,[n1 n2]);
% Solving the 2D problem
[x,s] = ASAP_Hankel_2D(z,r,0.5);
recovery_err = norm(x-ox,'fro')/norm(ox,'fro')