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

📄 receiver.m

📁 MATLAB Simulation of OFDM System
💻 M
字号:


function [flag, thres_idx, data_bits, raw_bits] = receiver(rx_signal, cir, sim_options);

global sim_consts;

[n_tx_antennas, n_rx_antennas] = get_n_antennas(sim_options);


%keyboard
%分组检测packet search
[flag, thres_idx, rx_signal] = rx_find_packet_edge(rx_signal, sim_options);

%频偏估计和矫正 Frequency error estimation and correction
rx_signal = rx_frequency_sync(rx_signal, sim_options);
%keyboard
%精确时间同步 Fine time synchronization
fine_time_est = rx_fine_time_sync(rx_signal, sim_options);

% Time synchronized signal
sync_time_signal = rx_signal(:,fine_time_est + sim_options.RxTimingOffset:length(rx_signal(1,:)));

%FFT返回频域 Return to frequency domain
[freq_tr_syms, freq_data_syms, freq_pilot_syms] = rx_timed_to_freqd(sync_time_signal, sim_options);
%keyboard
%信道估计 Channel estimation
channel_est = rx_estimate_channel(freq_tr_syms, cir, sim_options);

%相位跟踪 Phase tracker
freq_data_syms = rx_phase_tracker(freq_data_syms, freq_pilot_syms, channel_est, sim_options);

%接收分集操作 receiver diversity processing
[freq_data_syms,freq_pilot_syms] = rx_diversity_proc(freq_data_syms, freq_pilot_syms, ...
   channel_est, sim_options);

%keyboard
%解调 Demodulate
soft_bits = rx_demodulate(freq_data_syms, sim_options);
%keyboard
%解交织 Deinterleave if bits were interleaved
if sim_options.InterleaveBits
   deint_bits = rx_deinterleave(soft_bits, sim_options);
else
   deint_bits = soft_bits;
end
%keyboard
% 硬判决的软比特,用来测试未编码的BER
raw_bits = deint_bits > 0;
%keyboard
% depuncture
depunc_bits = rx_depuncture(deint_bits, sim_options.ConvCodeRate);

% 使用子载波的幅度作为软判决的权重
channel_amps = rx_gen_chan_amps(length(deint_bits), channel_est, sim_options);
%keyboard
if sim_options.InterleaveBits
   channel_amps = rx_deinterleave(channel_amps, sim_options);
end
channel_amps = rx_depuncture(channel_amps, sim_options.ConvCodeRate);
%keyboard

% 参考《OFDM无线局域网》76页卷积码解码用子载波幅度平方进行加权的软判决的好处。
viterbi_input = channel_amps(1:(sim_options.PacketLength+6)*2).* ...
   depunc_bits(1:(sim_options.PacketLength+6)*2);
%keyboard
% 维特比译码Viterbi decoding
data_bits = rx_viterbi_decode(viterbi_input);
%keyboard

⌨️ 快捷键说明

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