41 lines
1017 B
Matlab
41 lines
1017 B
Matlab
function s_R_tlide = get_downconversion_pulse(s_R, f_n)
|
|
|
|
config_parameters;
|
|
|
|
s_R_tlide = complex(zeros(1, len));
|
|
real_s_R_tlide = zeros(1, len);
|
|
imag_s_R_tlide = zeros(1, len);
|
|
|
|
% down conversion
|
|
for t_idx = 1:len
|
|
t = range_t(t_idx);
|
|
|
|
p = rem(t, T_r);
|
|
|
|
% if (p > T_p)
|
|
% continue
|
|
% end
|
|
|
|
n = (t - p) / T_r;
|
|
s_R_tlide(t_idx) = s_R(t_idx) * exp(-1 * 1j * 2 * pi * f_n(t_idx) * (t - n * T_r));
|
|
real_s_R_tlide(t_idx) = real(s_R_tlide(t_idx));
|
|
imag_s_R_tlide(t_idx) = imag(s_R_tlide(t_idx));
|
|
end
|
|
|
|
if figure_flag_3
|
|
figure(3)
|
|
title("Received signal (after down conversion)")
|
|
subplot(2, 1, 1);
|
|
plot(range_t, imag_s_R_tlide);
|
|
xlabel("Time (s)");
|
|
ylabel("sin(\omega t)");
|
|
ylim([-1, 1]);
|
|
|
|
subplot(2, 1, 2);
|
|
plot(range_t, real_s_R_tlide);
|
|
xlabel("Time (s)");
|
|
ylabel("cos(\omega t)");
|
|
ylim([-1, 1]);
|
|
end
|
|
|
|
end |