📄 get_preamble_signal.m
字号:
% Return preamble_signal: upsampled, pulse shaped and channel filtered version of% tx_signal,%% ch_len: length of channel impulse response in samples% tx_signal: the transmitted signal% TC: length of a chip in ns% FS_CONT: sampling frequency of "continuous" signal% CH_MODEL: number of channel model to use% CH_ATT_THLD_DB: rays with bigger attenuation are considered 0 in channel% impulse response% CH_RNG_SEED: seed of rng when drawing channel% PLOT_DEBUG: flag to indicate whether to make plots or not%% function [rx] = get_preamble_signal(tx_signal,...% compound_channel, ch_len, chip_span, TC,FS_CONT,PLOT_DEBUG)function [rx] = get_preamble_signal(tx_signal,... compound_channel, ch_len, chip_span, TC,FS_CONT,PLOT_DEBUG)samples_per_chip = TC * FS_CONT;%upsample to match FS_CONTtx_signal_up = upsample(tx_signal,samples_per_chip);rx = zeros(1,ch_len + length(tx_signal_up) - 1);%as most of the entries in tx_signal_up are zero, we can perform a%faster algo than convolution by just replicating the whole compound%channel at positions where we have +1 (-1) in the tx_signal_up signal.non_null_ind = find(tx_signal_up ~= 0);for i=1:length(non_null_ind) rx(non_null_ind(i):non_null_ind(i)+ch_len-1) = ... rx(non_null_ind(i):non_null_ind(i)+ch_len-1) + tx_signal_up(non_null_ind(i)).*compound_channel;end%cut overlap from the chip_span, chip_span - 0.5 all-zero chips in beginningif(chip_span~=0.5) rx = ... rx((chip_span-0.5)*samples_per_chip+1:end-((chip_span-0.5)*samples_per_chip));endreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -