-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain3.m
62 lines (46 loc) · 1.18 KB
/
main3.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FID = fopen('adc_data.bin','r');
data = fread(FID,'int16');
fclose(FID);
n = 256;
L = 128;
output = data;
output_cmplx = zeros(256*128*8,4);
for ch=1:4
for i = 1:128*256*8
output_cmplx(i,ch) = complex(output(8*(i-1)+2*ch-1) , output(8*(i-1)+2*ch));
end
end
Rx_complex_signal = output_cmplx(:,1);
y = zeros(256*128, 1);
for i=1:256*128
y(i) = Rx_complex_signal(i);
end
Y = reshape(y, n, L);
F_n = 1/sqrt(n) * dftmtx(n);
F_L = 1/sqrt(L) * dftmtx(L);
X_true = F_n * Y * transpose(F_L);
x_true_vec = X_true(:);
figure(1);
surfc(abs(X_true), 'EdgeColor', 'none');
title("2D FFT of true ADC data");
xlabel("Doppler Axis");
ylabel("Range Axis");
% k = 23; % sparsity
threshold = 25000;
X_estimated = OMP3(Y, threshold, n, L, F_n, F_L);
x_est_vec = X_estimated(:);
figure(2);
surfc(abs(X_estimated), 'EdgeColor', 'none');
title("Estimated 2D FFT from 2D OMP algorithm");
xlabel("Doppler Axis");
ylabel("Range Axis");
% figure(2);
% subplot(3,1,1);
% stem(abs(X_true), 'og');
% title('X True');
% subplot(3,1,2);
% stem(abs(X_estimated), 'ob');
% title('X Estimated');
% subplot(3,1,3);
% stem(abs(X_true-X_estimated), 'or');
% title('Difference (True-Estimated)');