clc;clear all;close all;
real_v = [0];
real_r = [20];
%% 初始化
C = 3e8;
fsweep = 150e6;
N = 768;
fshift = -1 * fsweep / 2 / (N - 1);
fc = 24e9;
Tburst = 5e-6;
La = 5; %传输损耗
LAMBDA = C / fc;
rx_power = ones(length(real_r),1);
%% 产生回波信号
[ma, mb] = lfmskGeneration(fc,real_v,real_r,fshift,fsweep,N,Tburst,rx_power); %产生回波信号
fma = fft(ma);
fmb = fft(mb);
index = cfar2(fma', 0.0001, 4, 2, 'CA')';
index = find(index ~= 0);
fb_abs = abs(fma);
peaksindex = [];
for i = 1:length(index)
if index(i) == 256
peaksindex = [peaksindex,index(i)];
elseif fb_abs(index(i)) > fb_abs(index(i)+1) && ...
fb_abs(index(i)) > fb_abs(index(i)-1)
peaksindex = [peaksindex,index(i)];
end
end
dp = -angle(fma(peaksindex)) + angle(fmb(peaksindex));
dr = C/(2*fsweep); %距离分辨率
dv = C/(2*Tburst*N* 2 * fc); %速度分辨率
peaksindex3 = peaksindex;
peaksindex(find(peaksindex > 180)) = peaksindex(find(peaksindex > 180)) - 257;
[ rng, vel] = GetRngVel(peaksindex,dp,dr,dv,N,fshift); %获取速度距离
figure(1);
plot(1:N,abs(fma));
rng