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

📄 rx_find_packet_edge.m

📁 ofdm系统仿真
💻 M
字号:
%Packet search
function [detected_packet, thres_idx] = rx_find_packet_edge(rx_signal, sys_parm)
    
    global ofdm_data_parm_const;
    
    search_win = ceil(1.5 * ofdm_data_parm_const.StartNoiseSamples);
    D = (sys_parm.TotNumSubc * sys_parm.OverSamp + ofdm_data_parm_const.CPLength) * 2 / 10;
    
    if sys_parm.PacketDetection
        %Calculate the delayd correlation
        delay_xcorr = rx_signal(1: search_win + 2 * D) .* conj(rx_signal(1 * D + 1 : search_win + 3 * D));

        %Moving average of the delayed correlation
        ma_delay_xcorr = abs(filter(ones(1, 2 * D), 1, delay_xcorr));

        %Moving average of received power
        ma_rx_pwr = filter(ones(1, 2 * D), 1, abs(rx_signal(:, 1 * D + 1: search_win + 3 * D)) .^ 2);

        %The decision variable
        delay_len = length(ma_delay_xcorr);
        ma_M = ma_delay_xcorr(1: delay_len) ./ ma_rx_pwr(1: delay_len);

        %Remove delay samples
        ma_M(1 : 2 * D) = [];

        threshold = 0.78;
        thres_idx = find(ma_M > threshold);
        if isempty(thres_idx)
            thres_idx = 1;
        else
            thres_idx = thres_idx(1);
        end        
    else
        thres_idx = ofdm_data_parm_const.StartNoiseSamples + 1;
    end
        
    %Delete the noise
    detected_packet = rx_signal(thres_idx: length(rx_signal));
end

⌨️ 快捷键说明

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