channel_est.m

来自「一个UWB仿真程序包」· M 代码 · 共 45 行

M
45
字号
%%%function [channel_mask est_sig_energy] = channel_est(rx_down, fine_sync_index, G, ...    pre_code, blocks_per_code_symbol,thld,PLOT_DEBUG)code_len = length(pre_code);%repeat code G timescode = repmat(pre_code,1,G)';%create a matrix of the stuff to accumulate so that we can write the whole%thing as a matrix productif(length(rx_down)<fine_sync_index-1+ ...        G*blocks_per_code_symbol*code_len) %we are too late -> sync failed    channel_mask = [];    est_sig_energy = 0;else    ch_mat = reshape(rx_down(fine_sync_index:fine_sync_index-1+ ...        G*blocks_per_code_symbol*code_len), ...        blocks_per_code_symbol,G*code_len);    %accumulate    channel_mask = ch_mat * code;    channel_mask_temp = channel_mask;    %apply thld    channel_mask(channel_mask < thld) = 0;    channel_mask(channel_mask >= thld) = 1;    %calculate mean energy    est_sig_energy = (channel_mask_temp' * channel_mask)./G;%    if(PLOT_DEBUG)%        figure%        plot(channel_mask_temp)%        hold on%        plot(max(channel_mask_temp)*channel_mask,'r')%        plot(thld*ones(1,length(channel_mask)),'m')%    endendreturn;

⌨️ 快捷键说明

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