Files
2024-05-09 16:48:29 +08:00

25 lines
502 B
Matlab

clc; clear;
configure_parameters;
global s_T s_R c
% 时域上的匹配滤波
matched_filter = conv(s_R, fliplr(s_T), 'same');
[~, peak] = max(matched_filter);
t_delay = peak / length(matched_filter) - 0.5;
d = (c * t_delay) / 2;
fprintf("r = %f, predict d = %f\n", r_0, d);
fprintf("eps = %f\n", abs(r_0 - d));
figure(1);
subplot(311);
plot(t, s_T);
title("Chirp signal");
subplot(312);
plot(t, s_R);
title("Received Chirp signal");
subplot(313);
plot(t, matched_filter);
title("Matcher filter");