📄 sfd_detection.m
字号:
function [sfd_index] = sfd_detection(rx_down,sfd_code,sfd_thld, ... fine_sync_index,channel_mask,G,CODE_ID,blocks_per_code_symbol,PLOT_DEBUG)code_len = length(len31_preamble_code(CODE_ID));samples_per_code = code_len * blocks_per_code_symbol;%integrate over 31*16 samples ie one whole code. at the same time also%apply the channel mask and the code.rx_sfd_zero = zero_pad_reshape(rx_down(fine_sync_index+ ... G*samples_per_code:end),samples_per_code);if(isempty(rx_sfd_zero)) sfd_index = 0;else rx_sfd_weighted = reshape(rx_sfd_zero,blocks_per_code_symbol, ... length(rx_sfd_zero)/blocks_per_code_symbol)'*channel_mask; rx_sfd_int = abs(len31_preamble_code(CODE_ID))* ... (reshape(rx_sfd_weighted,code_len,length(rx_sfd_weighted)/code_len)); %create sfd_template sfd_templ = 2*abs(sfd_code)-1; sfd_corr = conv(rx_sfd_int,fliplr(sfd_templ));% if(PLOT_DEBUG)% figure% plot(sfd_corr(length(sfd_templ):end))% hold on% plot(sfd_thld * ones(1,length(sfd_corr)),'m')% end %find the first value in the correlation above the threshold sfd_ind_corr = find(sfd_corr(length(sfd_templ):end-(length(sfd_templ)-1))>=sfd_thld); if(isempty(sfd_ind_corr)) sfd_index = 0; else sfd_index = samples_per_code*(sfd_ind_corr(1) - 1) + fine_sync_index+ ... G*samples_per_code; endendreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -