物理层 手册专题 1,662 字

Matlab:默认函数:LTE 上行(SC-FDMA)解调(不含 DMRS 分析)

本节我将用“半真实数据”演示 OFDM 解调的工作过程。所谓半真实,是指这里使用的数据并非来自真实 eNB,而是由真实硬件矢量信号发生器产生、并由矢量信号分析仪带特殊同步信号采集得到。因此你不必实现同步算法以及大量补偿——那对一个示例来说负…

采集:2026-11-18T02:08:48+08:00 · 查看英文原文 ↗

原始来源:https://www.sharetechnote.com/html/Handbook_LTE_UL_Demodulation_Ex01.html

正文

本节我将用“半真实数据”演示 OFDM 解调的工作过程。所谓半真实,是指这里使用的数据并非来自真实 eNB,而是由真实硬件(矢量信号发生器)产生、并由矢量信号分析仪带特殊同步信号采集得到。因此你不必实现同步算法以及大量补偿——那对一个示例来说负担过重。如果你有兴趣以入门水平从事 LTE DSP 工作,这也可以提供帮助或动力。

与 LTE 下行(OFDM)解调页面相比,上行多出两个步骤。子载波位于离 FFT 频点半个子载波的位置,因此接收机先把信号搬移 7.5 kHz。数据在发送端还经过 DFT 扩展,因此接收机在 FFT 之后要对所占子载波做一次 IFFT。

本节涵盖的主题如下。

  • 结果
  • 数据的 LTE 配置
  • Matlab 代码
  • 参考资料 SC-FDMA 链路能否还原出干净的 QPSK 符号,时隙中哪个符号的表现又与众不同?下图针对子帧 0 时隙 0 的七个 SC-FDMA 符号同时回答了这两个问题。每一行是一个符号,每一列是处理中的一个阶段。

下面是此处所列 Matlab 源代码的运行结果。(A) 显示子帧 0 第一个时隙内各符号 IFFT 结果的幅度。(B) 是 (A) 的 I/Q 图(实部与虚部)。你会注意到一定程度上的旋转(相移)。(C) 是对 (B) 进行相位补偿后的结果。

子帧 0 时隙 0 中七个 SC-FDMA 符号的 IFFT 幅度、原始星座与相位补偿后星座

图注:子帧 0 时隙 0 中七个 SC-FDMA 符号的 IFFT 幅度、原始星座与相位补偿后星座

各行为时隙 0 的 SC-FDMA 符号 0 至 6。列 (A) 是 300 个恢复值的幅度,列 (B) 是原始星座,列 (C) 是经固定相位旋转后的星座。

  • 符号 0 至 2 以及 4 至 6:四个紧密的 QPSK 点簇,在列 (B) 中呈旋转状,在列 (C) 中为正方形。
  • 符号 3:列 (A) 中为一条平直线,列 (B) 和 (C) 中为一个圆环。
  • 此处的列 (A) 不是频谱:对数据符号而言,它是 IFFT 之后的幅度,每个 QPSK 符号对应一个点。 符号 3 是 PUSCH DMRS。在常规循环前缀下,36.211 v19.3.0 第 5.5.2.1.2 条把它放在每个时隙的第四个符号。DMRS 不经变换预编码而直接映射到子载波上,因此代码对该符号跳过 IFFT。25 RB 对应的序列由 Zadoff-Chu 序列构造,其幅度恒定而相位变化,因此幅度是一条平直线,其点分布在一个圆周上。

数据符号呈现的则是相反的情形。它们在 IFFT 之后的取值就是 QPSK 符号本身,因此列 (A) 中的幅度大致恒定,星座呈现四个点簇。在 LTE 下行(OFDM)解调的示例中,同一列显示的是频谱,因为 OFDM 数据在接收端不需要 IFFT。

一个固定的 PhaseOffset 值 exp(-jπ/8),即 -22.5 度的旋转,就能把每个数据符号摆正。因此相位在整个时隙内并不漂移。真实接收机会用符号 3 中的 DMRS 来估计这一旋转,而不是靠眼睛判断。

  • 符号 3 中的 DMRS:无变换预编码,幅度恒定,星座中呈圆环。
  • IFFT 之后的数据:即 QPSK 符号本身。
  • 整个时隙共用一个相位值:真实接收机会以 DMRS 作为求该值的参考。 该配置设定了代码所依赖的三个数字:FFT 点数、子载波数量,以及用于变换解码的 IFFT 点数。信号发生器使用了以下设置。

本例使用的数据来自以下 LTE 配置。

  • 系统带宽 = 5 MHz
  • RB 数量 = 25
  • 物理小区 ID = 0
  • 采样率 = 7.68 MHz 5 MHz 的 LTE 载波有 25 个 RB,代码中设 N_RB = 25。因此该信号占用全部 25 个 RB,即 300 个子载波,代码中的 IFFT 为 300 点。36.211 第 5.3.3 条只允许素因子为 2、3、5 的 DFT 点数,而 300 = 2² · 3 · 5² 满足该规则。采样率 7.68 Msps 对应 512 点 FFT,与下行相同。

物理小区 ID = 0 与跳变设置共同决定 DMRS 序列组。数据符号的解调并不依赖它。小区标识只在后面 QPSK 判决之后对比特解扰时才会用到。

  • 25 个 RB:300 个子载波,变换解码使用 300 点 IFFT。
  • 300 = 2² · 3 · 5²:36.211 允许的 DFT 点数。
  • 7.68 Msps:512 点 FFT,与 5 MHz 下行相同。 代码按 SC-FDMA 发送端的逆序进行:去除循环前缀、抵消半子载波偏移、做 FFT、取出 300 个占用频点,再做一次 IFFT 以抵消变换预编码。

下面是产生上图结果的 Matlab 源代码。代码有意写得较长。如果用 for 循环,我本可以把它写得非常短,但那样反而更难理解。因此我尽量把每个过程一步步写出。希望即使它看起来稍显冗长,你也能更容易跟上。

clear all;

% you can download the data file in this example from here.

% this is for reading the baseband IQ data of OFDM symbol in time domain.

% detailed explantion for this three line and file format in this example is described in

% Matlab : Read Number in Binary file page.

fid = fopen(‘UL_5_25_NoFilter_S7_68_Trig.bin’,‘r’);

[data,count] = fread(fid, ‘single’);

fclose(fid);

% This variable represents the first sample in the first SCFDM symbol.

% How do I know this ? This is just a magic number I could figure out from the vector signal

% analyzer. Just think this is just a given number. If you seriously want to work in this

% area, try to implement the algorithm to find this number on your own.

Offset = 280228;

% Nfft represents the FFT size for the specified system bandwidth. 512 is the FFT size for

% 5 Mhz System Bandwidth.

Nfft = 512;

% N_RB is the number of RB assinged to this signal. N_RE is the number of Resource Elements

% in this signal and can be calculated from N_RB. This N_RE determines the IFFT size in

% demodulation process (N_RE is the size of IFFT)

N_RB = 25;

N_RE = N_RB * 12;

% SamplingScale is to figure out the number of samples in CP and OFDM Symbol for each specific system

% Bandwidth from the 20 Mhz Bandwidth. Physical Layer Parameters - FDD, Downlink will help you understand

% the meaning of each numbers here.

SamplingScale = (double(Nfft)/2048);

CP_LengthList = SamplingScale * [160;144;144;144;144;144;144];

Symbol_LengthList = SamplingScale * [2048;2048;2048;2048;2048;2048;2048];

% This is to compensate the phase rotation shown in track (B) of the result.

% How do I figure out this number. I just got it by eye balling and a couple of try and error.

% If you seriously want to work in this area, try to implement the algorithm to find this

% number on your own.

PhaseOffset = exp(-j*pi/8);

% This is to generate a complex numbered sequence to shift the frequency of the I/Q signal by 7.5 Khz

% the number of samples of this data is same as the number of samples of each SC-FDM symbol.

Ts = 1.0/(7.68 * 10^6);

t = linspace(0,Nfft-1,Nfft);

t = t .* Ts;

Fshift = 7.5 * 1000 ;

FrequencyShift = exp(j2piFshiftt);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demoulate the symbol 0 within the slot 0 of Subframe 0.

% ChuckStart here indicates the index(position) of the first sample within the binary file.

% You would notice that I skip the first CP length. This is the same effect of removing the

% first CP as described in CP removal described in RE Map to/from Antenna page.

ChunkStart = Offset …

  • CP_LengthList(1);

% This variable indicates the number of samples within the first OFDM symbol excluding the CP

ChunkLength = Symbol_LengthList(1);

% This is to read I/Q data pair.

DataChunk = data((2.* ChunkStart)-1 : (2.*(ChunkStart+ChunkLength)-2));

% This is to separate I and Q into a separate array (vector)

DataChunkI = DataChunk(1:2:length(DataChunk));

DataChunkQ = DataChunk(2:2:length(DataChunk));

% This is to combine I array and Q array into a complex number array.

DataChunkComplex = DataChunkI + j*DataChunkQ;

% This is to convert the time domain OFDM symbol into the frequency domain. Note that the data

% is shifted in frequency domain

DataChunkFFT = fft(DataChunkComplex .* FrequencyShift’);

% This is to take out the data samples which will be mapped to each resource element

% within the symbol

DataChunkFFT_RE = [DataChunkFFT(end-(N_RE/2-1):end)’ DataChunkFFT(1:N_RE/2)’];

% This is to perform the subcarrier demapping (converting each symboles of resource elements

% to original binary data

DataChunkFFT_IFFT = ifft(DataChunkFFT_RE);

DataChunkFFT_IFFT = DataChunkFFT_IFFT/max(abs(DataChunkFFT_IFFT));

DataChunkFFT_IFFT = DataChunkFFT_IFFT;

DataChunkFftMag = abs(DataChunkFFT_IFFT);

% This is to plot the IFFT result in magnitude.

% The result of this block is shown in track (A) of the figure at the beginning of the page

subplot(7,5,[1 3]);

plot(DataChunkFftMag);xlim([1, length(DataChunkFftMag)]); ylim([0 1.2]);

set(gca,‘xticklabel’,[]);set(gca,‘yticklabel’,[]);

set(gca,‘xtick’,[]);set(gca,‘ytick’,[]);

% This is to plot the IFFT result in complex domain (I and Q axis)

% The result of this block is shown in track (B) of the figure at the beginning of the page

subplot(7,5,4);

plot(real(DataChunkFFT_IFFT),imag(DataChunkFFT_IFFT),‘ro’,‘MarkerFaceColor’,[1 0 0],‘MarkerSize’,2);

xlim([-1 1]);ylim([-1 1]);

% This is to plot the FFT result rotated by the angle specified by the variable PhaseOffset

% The result of this block is shown in track (C) of the figure at the beginning of the page

subplot(7,5,5);

DataChunkFFT_Comp = DataChunkFFT_IFFT .* PhaseOffset;

plot(real(DataChunkFFT_Comp),imag(DataChunkFFT_Comp),‘ro’,‘MarkerFaceColor’,[1 0 0],‘MarkerSize’,2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 1 within the slot 0 of Subframe 0. Everything is same

% as in the symbol 0 analysis except the ‘ChunkStart. So I would not explain any further.

  • CP_LengthList(1) + Symbol_LengthList(1) …

  • CP_LengthList(2) ;

ChunkLength = Symbol_LengthList(2);

subplot(7,5,[6 8]);

subplot(7,5,9);

subplot(7,5,10);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 2 within the slot 0 of Subframe 0. Everything is same

  • CP_LengthList(2) + Symbol_LengthList(2) …

  • CP_LengthList(3);

ChunkLength = Symbol_LengthList(3);

subplot(7,5,[11 13]);

subplot(7,5,14);

subplot(7,5,15);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 3 within the slot 0 of Subframe 0. The symbol 3(the fourth

% symbol in LTE UL slot is special. It is special symbol carrying PUSCH DMRS data, it does

% not carry any user data. It just carries special reference signal based on Zad-off Chu

% sequence. This signal does not go through transformation procoding when it is transmitted

% so this does not go through IFFT process when it is demodulated. But I am still using the

% variable xxxx_IFFT in this step as I used for other symbols.

  • CP_LengthList(3) + Symbol_LengthList(3) …

  • CP_LengthList(4);

ChunkLength = Symbol_LengthList(4);

DataChunkFFT_IFFT = DataChunkFFT_RE;

subplot(7,5,[16 18]);

subplot(7,5,19);

subplot(7,5,20);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 4 within the slot 0 of Subframe 0. Everything is same

  • CP_LengthList(4) + Symbol_LengthList(4) …

  • CP_LengthList(5);

ChunkLength = Symbol_LengthList(5);

subplot(7,5,[21 23]);

subplot(7,5,24);

subplot(7,5,25);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 5 within the slot 0 of Subframe 0. Everything is same

  • CP_LengthList(5) + Symbol_LengthList(5) …

  • CP_LengthList(6);

ChunkLength = Symbol_LengthList(6);

subplot(7,5,[26 28]);

subplot(7,5,29);

subplot(7,5,30);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Demodulation of symbol 6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This is to demodulate the symbol 6 within the slot 0 of Subframe 0. Everything is same

  • CP_LengthList(6) + Symbol_LengthList(6) …

  • CP_LengthList(7);

ChunkLength = Symbol_LengthList(7);

subplot(7,5,[31 33]);

subplot(7,5,34);

subplot(7,5,35);

频移来自上行基带公式。36.211 第 5.6 条把子载波 k 放在 (k + 1/2)Δf 处,因此没有子载波落在直流上,每个子载波都离 FFT 频点 7.5 kHz。若不搬移,每个子载波都会泄漏到相邻频点,星座也无法形成清晰的点簇。

FrequencyShift 是以正号写出的,但代码以 FrequencyShift’ 的方式应用它。在 Matlab 中,’ 运算符是共轭转置。因此样本被乘以 exp(-j2π · 7.5 kHz · t),从而把子载波 k 从 (k + 1/2)Δf 下移到 kΔf。于是子载波落在 FFT 频点 -150 至 149 上。

FFT 输出把负频率放在向量的末尾。因此 DataChunkFFT_RE 取最后 150 个频点和最前 150 个频点,从而按频率顺序得到 300 个子载波。同一个 ’ 运算符还会对这 300 个值取共轭,因此 IFFT 返回的 QPSK 符号是被共轭且顺序颠倒的。星座仍显示四个 QPSK 点簇。若要从其中解码比特,接收机应在两处都改用普通转置 .’。

同样的半子载波偏移也解释了为什么“循环前缀相关”页面在每个上行循环前缀处得到负的 Re(r)。这里的偏移在 FFT 之前就被去除,且循环前缀被跳过,因此该符号对结果没有影响。

代码中命名的数据文件 UL_5_25_NoFilter_S7_68_Trig.bin 并不在站点上,因此代码顶部的下载链接无法使用。站点上确实存在的上行文件 LTE_UL_5_1_CID_0_1RB_NoFilter.bin 标注为 1 RB 采集,与本代码的 25 RB 设置并不匹配。

  • 先做 7.5 kHz 搬移:抵消上行的 (k + 1/2)Δf 偏移。
  • Matlab 中 ’ 会取共轭:搬移方向向下,恢复出的符号呈共轭形式。
  • 从 FFT 两端取 300 个频点:负频率位于向量末尾。
  • 数据做 IFFT,DMRS 不做:只有数据经过了变换预编码。
  • 下载链接已失效:站点上没有该 25 RB 文件。 3GPP TS 36.211 v19.3.0——第 5.3.3 条(变换预编码)、第 5.5.2.1.2 条(DMRS 映射)、第 5.6 条(SC-FDMA 基带信号生成)

LTE 下行(OFDM)解调

LTE 定时同步:循环前缀相关

图示资源


同族文档