📄 ed_decoder.m
字号:
%%%function [demod_bit] = ... ed_decoder(rx_data, ths, ... symbol_start, ... burstlength,samples_per_burst,samples_per_symbol, ... channel_mask, channel_mask_unit, ... timing_offset_samples, ... PACKET_LENGTH, FS_CONT, T_INT, N_INT) % Get the signal only where necessary % Note: timing_offset_samples is in FS_CONT units burst_start_0 = symbol_start + ths*samples_per_burst + timing_offset_samples; burst_start_1 = burst_start_0 + (samples_per_symbol/2); % Energy detection receiver and decoding if isempty(channel_mask) n = burstlength-rem(burstlength,T_INT*FS_CONT*N_INT); else n = round(length(channel_mask)*channel_mask_unit*FS_CONT); end signal_idx_0 = repmat(burst_start_0,n,1)+repmat((0:n-1)',1,PACKET_LENGTH) + 1; signal_idx_1 = signal_idx_0 + samples_per_symbol/2 + 1; % Energy receiver [rx_down_0,samples_per_tint] = ... ed_receiver(rx_data(reshape(signal_idx_0,1, PACKET_LENGTH*n)),T_INT, ... FS_CONT,N_INT,-1); [rx_down_1,samples_per_tint] = ... ed_receiver(rx_data(reshape(signal_idx_1,1, PACKET_LENGTH*n)),T_INT, ... FS_CONT,N_INT,-1); % Apply the channel mask if ~isempty(channel_mask) channel_mask_long = repmat(channel_mask,1,PACKET_LENGTH); rx_down_1 = rx_down_1.*channel_mask_long; rx_down_0 = rx_down_0.*channel_mask_long; end % Decision rule and detection rx_down = ... sum(reshape((rx_down_0 - rx_down_1),n/(T_INT*FS_CONT*N_INT),PACKET_LENGTH), 1); idx_dec0 = find(rx_down>0); idx_dec1 = find(rx_down<0); idx_unknown = find(rx_down==0); demod_bit = []; demod_bit(idx_dec0) = 0; demod_bit(idx_dec1) = 1; demod_bit(idx_unknown) = round(rand(1,length(idx_unknown)));return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -