41 lines
912 B
Matlab
41 lines
912 B
Matlab
function [C_n, f_n, s_T] = get_transmitted_pulse()
|
|
|
|
config_parameters;
|
|
|
|
s_T = complex(zeros(1, len));
|
|
C_n = zeros(1, len);
|
|
f_n = zeros(1, len);
|
|
|
|
for t_idx = 1:len
|
|
t = range_t(t_idx);
|
|
p = rem(t, T_r); % p = t - nT_r
|
|
|
|
if (p > T_p)
|
|
continue
|
|
end
|
|
|
|
C_n(t_idx) = floor(rand * (M - 1));
|
|
f_n(t_idx) = f_c + C_n(t_idx) * Delta_f;
|
|
s_T(t_idx) = exp(1j * 2 * pi * f_n(t_idx) * p);
|
|
end
|
|
|
|
real_s_T = real(s_T);
|
|
imag_s_T = imag(s_T);
|
|
|
|
if figure_flag_1
|
|
figure(1)
|
|
title("Transmitted signal")
|
|
subplot(2, 1, 1);
|
|
plot(range_t, imag_s_T);
|
|
xlabel("Time (s)");
|
|
ylabel("sin(\omega t)");
|
|
ylim([-1, 1]);
|
|
|
|
subplot(2, 1, 2);
|
|
plot(range_t, real_s_T);
|
|
xlabel("Time (s)");
|
|
ylabel("cos(\omega t)");
|
|
ylim([-1, 1]);
|
|
end
|
|
end
|