⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fine_sync_block.m

📁 一个UWB仿真程序包
💻 M
字号:
function [fine_sync_index] = fine_sync(rx_down,corr_template,thld,...                blocks_per_code_symbol,code_len,coarse_sync_index,PLOT_DEBUG);         %from -block to + 2blocks    corr3 = conv(rx_down, fliplr(corr_template));    corr3 = corr3(length(corr_template):length(corr_template)+blocks_per_code_symbol*4);    %[max_corr4, ind_corr4] = max(corr3(blocks_per_code_symbol:2*blocks_per_code_symbol));        %the max cannot be in last part    [max_corr4, ind_corr4] = max(corr3(1:end-blocks_per_code_symbol));        %ind_corr4 = ind_corr4 + blocks_per_code_symbol - 1;        %we now go backwards through the correlation until we find one sample    %that is not above the threshold, the max number of steps we go back is    %blocks_per_code_symbol/2    current_index = ind_corr4;    t0_index = ind_corr4;    for i=1:floor(blocks_per_code_symbol/2)        current_index = current_index - 1;        %wrap around if it goes over the beginning        if(current_index == 0)            break;        end        if(corr3(current_index) >= thld && corr3(current_index)>corr3(current_index+blocks_per_code_symbol))            t0_index = current_index;        end    end    fine_sync_index = coarse_sync_index - blocks_per_code_symbol + t0_index - 1;    %     if(PLOT_DEBUG)%         figure%         plot(corr3)%         hold on%         plot(thld*ones(1,length(corr3)),'m')%         line([t0_index t0_index],[0 max(corr3)],'Color','g')%         line([ind_corr4 ind_corr4],[0 max(corr3)],'Color','y')%     endreturn;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -