Update Radar simulation

This commit is contained in:
Ksyer
2024-02-21 16:41:12 +08:00
parent ec0f95c639
commit f357a0c3a7
20 changed files with 219 additions and 187 deletions
@@ -0,0 +1,47 @@
function v = get_doppler(s_T, s_R)
global T_r delta_t c f_c velocity max_t slow_len;
freq_s_T = 1 / T_r;
slow_freqs = ((0:slow_len - 1) * (1 / T_r)) / slow_len;
range_t_slow = 1:slow_len;
num_slow = max_t / T_r;
s_R_slow = zeros(1, slow_len);
k = floor(T_r / delta_t);
init_idx = 1;
while abs(s_R(init_idx)) == 0
init_idx = init_idx + 1;
end
for i = 0:num_slow - 1
while abs(s_R(init_idx + i * k)) == 0
init_idx = init_idx + 1;
end
s_R_slow(i + 1) = s_R(init_idx + i * k);
end
s_R_fft = fft(s_R_slow);
[~, max_index_s_R] = max(s_R_fft);
freq_s_R = slow_freqs(max_index_s_R);
figure(2);
subplot(2, 1, 1);
plot(range_t_slow, abs(s_R_slow));
title(sprintf('s_R'));
subplot(2, 1, 2);
plot(slow_freqs, abs(s_R_fft));
title(sprintf('s_R_fft, freq = %E', freq_s_R));
xlabel('频率 (Hz)');
f_d = freq_s_T - freq_s_R;
fprintf("doppler_freq = %E\n\n", f_d);
v = (c * f_d) / (2 * f_c);
fprintf("v: %E\norigin_velocity: %E\n", v, velocity);
end