找到这篇文章的同志们,一定正在LTE生死线上苦苦挣扎,大家都知道对LTE信号进行采集的时候,是采用30.72M(15K✖2048)的时钟频率,然后呢,LTE频带的带宽是18M(15K✖1200)为了避免大家少走弯路,我将代码附在文章末尾。我们可以采集到的信号如下图所示。

大家可以看到这与事实是相符合的,在中心频率的左右各是±9MHz,因此我们可以通过查找移动,联通,电信对应的下行频段信息,然后就可以采集到信息了。

帧同步如下所示。

频偏估计以及MIB就不一一展示了,大家可以运行程序调参。

%% Connect to RadioradioFound = false;
radiolist = findsdru;
for i = 1:length(radiolist)if strcmp(radiolist(i).Status, 'Success')if strcmp(radiolist(i).Platform, 'B210')radio = comm.SDRuReceiver('Platform','B210', ...'SerialNum', radiolist(i).SerialNum);radio.MasterClockRate = 1.92e6 * 4; % Need to exceed 5 MHz minimumradio.DecimationFactor = 4;         % Sampling rate is 1.92e6radioFound = true;break;endif (strcmp(radiolist(i).Platform, 'X300') || ...strcmp(radiolist(i).Platform, 'X310'))radio = comm.SDRuReceiver('Platform',radiolist(i).Platform, ...'IPAddress', radiolist(i).IPAddress);radio.MasterClockRate = 184.32e6;radio.DecimationFactor = 96;        % Sampling rate is 1.92e6radioFound = true;endif (strcmp(radiolist(i).Platform, 'N300') || ...strcmp(radiolist(i).Platform, 'N310'))radio = comm.SDRuReceiver('Platform',radiolist(i).Platform, ...'IPAddress', radiolist(i).IPAddress);radio.MasterClockRate = 122.88e6;radio.DecimationFactor = 64;        % Sampling rate is 1.92e6radioFound = true;endif (strcmp(radiolist(i).Platform, 'N320/N321'))radio = comm.SDRuReceiver('Platform',radiolist(i).Platform, ...'IPAddress', radiolist(i).IPAddress);radio.MasterClockRate = 245.76e6;radio.DecimationFactor = 128;        % Sampling rate is 1.92e6radioFound = true;endend
endif ~radioFounderror(message('sdru:examples:NeedMIMORadio'));
endradio.ChannelMapping = [1 2];     % Receive signals from both channels
radio.CenterFrequency = 900e6;
radio.Gain = 30;
radio.SamplesPerFrame = 19200; % Sampling rate is 1.92 MHz. LTE frames are 10 ms long
radio.OutputDataType = 'double';
radio.EnableBurstMode = true;
radio.NumFramesInBurst = 4;
radio.OverrunOutputPort = true;radio%% Capture SignalburstCaptures = zeros(19200,4,2);len = 0;
for frame = 1:4while len == 0[data,len,lostSamples] = step(radio);burstCaptures(:,frame,:) = data;endlen = 0;
end
release(radio);eNodeBOutput = reshape(burstCaptures,[],2);
sr = 1.92e6 ; % LTE sampling rate% Check for presence of LTE Toolbox
if isempty(ver('lte')) error(message('sdru:examples:NeedLST'));
endseparator = repmat('-',1,50);
% plots
if (~exist('channelFigure','var') || ~isvalid(channelFigure))channelFigure = figure('Visible','off');
end
[spectrumAnalyzer,synchCorrPlot,pdcchConstDiagram] = ...hSIB1RecoveryExamplePlots(channelFigure,sr);
% PDSCH EVM
pdschEVM = comm.EVM();
pdschEVM.MaximumEVMOutputPort = true;% Set eNodeB basic parameters
enb = struct;                   % eNodeB config structure
enb.DuplexMode = 'FDD';         % assume FDD duxplexing mode
enb.CyclicPrefix = 'Normal';    % assume normal cyclic prefix
enb.NDLRB = 6;                  % Number of resource blocks
ofdmInfo = lteOFDMInfo(enb);    % Needed to get the sampling rateif (isempty(eNodeBOutput))fprintf('\nReceived signal must not be empty.\n');return;
end% Display received signal spectrum
fprintf('\nPlotting received signal spectrum...\n');
step(spectrumAnalyzer, awgn(eNodeBOutput, 100.0));if (sr~=ofdmInfo.SamplingRate)fprintf('\nResampling from %0.3fMs/s to %0.3fMs/s for cell search / MIB decoding...\n',sr/1e6,ofdmInfo.SamplingRate/1e6);
elsefprintf('\nResampling not required; received signal is at desired sampling rate for cell search / MIB decoding (%0.3fMs/s).\n',sr/1e6);
end
% Downsample received signal
nSamples = ceil(ofdmInfo.SamplingRate/round(sr)*size(eNodeBOutput,1));
nRxAnts = size(eNodeBOutput, 2);
downsampled = zeros(nSamples, nRxAnts);
for i=1:nRxAntsdownsampled(:,i) = resample(eNodeBOutput(:,i), ofdmInfo.SamplingRate, round(sr));
end%% Frequency offset estimation and correction
fprintf('\nPerforming frequency offset estimation...\n');
delta_f = lteFrequencyOffset(setfield(enb,'DuplexMode','FDD'), downsampled); %#ok<SFLD>
fprintf('Frequency offset: %0.3fHz\n',delta_f);
downsampled = lteFrequencyCorrect(enb, downsampled, delta_f);%% Cell Search and Synchronization
% Cell search to find cell identity and timing offset
fprintf('\nPerforming cell search...\n');
[cellID, offset] = lteCellSearch(enb, downsampled);corr = cell(1,3);
for i = 0:2enb.NCellID = mod(cellID + i,504);[~,corr{i+1}] = lteDLFrameOffset(enb, downsampled);corr{i+1} = sum(corr{i+1},2);
end
threshold = 1.3 * max([corr{2}; corr{3}]); % multiplier of 1.3 empirically obtained
if (max(corr{1})<threshold)    warning('sdru:examples:WeakSignal','Synchronization signal correlation was weak; detected cell identity may be incorrect.');
end
enb.NCellID = cellID;% plot PSS/SSS
synchCorrPlot.YLimits = [0 max([corr{1}; threshold])*1.1];
step(synchCorrPlot, [corr{1} threshold*ones(size(corr{1}))]);% perform timing synchronisation
fprintf('Timing offset to frame start: %d samples\n',offset);
downsampled = downsampled(1+offset:end,:);
enb.NSubframe = 0;% show cell-wide settings
fprintf('Cell-wide settings after cell search:\n');
disp(enb);%% OFDM Demodulation and Channel Estimation  % Channel estimator configuration
cec.PilotAverage = 'UserDefined';     % Type of pilot averaging
cec.FreqWindow = 9;                   % Frequency window size
cec.TimeWindow = 9;                   % Time window size
cec.InterpType = 'cubic';             % 2D interpolation type
cec.InterpWindow = 'Centered';        % Interpolation window type
cec.InterpWinSize = 1;                % Interpolation window size  % Assume 4 cell-specific reference signals for initial decoding attempt;
% ensures channel estimates are available for all cell-specific reference
% signals
enb.CellRefP = 4;   fprintf('Performing OFDM demodulation...\n\n');griddims = lteResourceGridSize(enb); % Resource grid dimensions
L = griddims(2);                     % Number of OFDM symbols in a subframe
% OFDM demodulate signal
rxgrid = lteOFDMDemodulate(enb, downsampled);
if (isempty(rxgrid))fprintf('After timing synchronization, signal is shorter than one subframe so no further demodulation will be performed.\n');return;
end
% Perform channel estimation
if (strcmpi(enb.DuplexMode,'TDD'))enb.TDDConfig = 0;enb.SSC = 0;
end
[hest, nest] = lteDLChannelEstimate(enb, cec, rxgrid(:,1:L,:));%% PBCH Demodulation, BCH Decoding, MIB parsingfprintf('Performing MIB decoding...\n');
pbchIndices = ltePBCHIndices(enb);
[pbchRx, pbchHest] = lteExtractResources( ...pbchIndices, rxgrid(:,1:L,:), hest(:,1:L,:,:));% Decode PBCH
[bchBits, pbchSymbols, nfmod4, mib, enb.CellRefP] = ltePBCHDecode( ...enb, pbchRx, pbchHest, nest); % Parse MIB bits
enb = lteMIB(mib, enb); enb.NFrame = enb.NFrame+nfmod4;% Display cell wide settings after MIB decoding
fprintf('Cell-wide settings after MIB decoding:\n');
disp(enb);if (enb.CellRefP==0)fprintf('MIB decoding failed (enb.CellRefP=0).\n\n');return;
end
if (enb.NDLRB==0)fprintf('MIB decoding failed (enb.NDLRB=0).\n\n');return;
end%% OFDM Demodulation on Full Bandwidthfprintf('Restarting reception now that bandwidth (NDLRB=%d) is known...\n',enb.NDLRB);% Resample now we know the true bandwidth
ofdmInfo = lteOFDMInfo(enb);
if (sr~=ofdmInfo.SamplingRate)fprintf('\nResampling from %0.3fMs/s to %0.3fMs/s...\n',sr/1e6,ofdmInfo.SamplingRate/1e6);
elsefprintf('\nResampling not required; received signal is at desired sampling rate for NDLRB=%d (%0.3fMs/s).\n',enb.NDLRB,sr/1e6);
end
nSamples = ceil(ofdmInfo.SamplingRate/round(sr)*size(eNodeBOutput,1));
resampled = zeros(nSamples, nRxAnts);
for i = 1:nRxAntsresampled(:,i) = resample(eNodeBOutput(:,i), ofdmInfo.SamplingRate, round(sr));
end% Perform frequency offset estimation and correction
fprintf('\nPerforming frequency offset estimation...\n');delta_f = lteFrequencyOffset(setfield(enb,'DuplexMode','FDD'), resampled); %#ok<SFLD>
fprintf('Frequency offset: %0.3fHz\n',delta_f);
resampled = lteFrequencyCorrect(enb, resampled, delta_f);% Find beginning of frame
fprintf('\nPerforming timing offset estimation...\n');
offset = lteDLFrameOffset(enb, resampled);
fprintf('Timing offset to frame start: %d samples\n',offset);
resampled = resampled(1+offset:end,:);   % OFDM demodulation
fprintf('\nPerforming OFDM demodulation...\n\n');
rxgrid = lteOFDMDemodulate(enb, resampled);   %% SIB1 Decoding% Check this frame contains SIB1, if not advance by 1 frame provided we
% have enough data, terminate otherwise.
if (mod(enb.NFrame,2)~=0)                    if (size(rxgrid,2)>=(L*10))rxgrid(:,1:(L*10),:) = [];   fprintf('Skipping frame %d (odd frame number does not contain SIB1).\n\n',enb.NFrame);else        rxgrid = [];endenb.NFrame = enb.NFrame + 1;
end% Advance to subframe 5, or terminate if we have less than 5 subframes
if (size(rxgrid,2)>=(L*5))rxgrid(:,1:(L*5),:) = [];   % Remove subframes 0 to 4
else    rxgrid = [];
end
enb.NSubframe = 5;if (isempty(rxgrid))fprintf('Received signal does not contain a subframe carrying SIB1.\n\n');
end% Reset the HARQ buffers
decState = [];% While we have more data left, attempt to decode SIB1
while (size(rxgrid,2) > 0)fprintf('%s\n',separator);fprintf('SIB1 decoding for frame %d\n',mod(enb.NFrame,1024));fprintf('%s\n\n',separator);% Reset the HARQ buffer with each new set of 8 frames as the SIB1% info may be differentif (mod(enb.NFrame,8)==0)fprintf('Resetting HARQ buffers.\n\n');decState = [];end% Extract current subframerxsubframe = rxgrid(:,1:L,:);% Perform channel estimation[hest,nest] = lteDLChannelEstimate(enb, cec, rxsubframe);    fprintf('Decoding CFI...\n\n');pcfichIndices = ltePCFICHIndices(enb);  % Get PCFICH indices[pcfichRx, pcfichHest] = lteExtractResources(pcfichIndices, rxsubframe, hest);% Decode PCFICHcfiBits = ltePCFICHDecode(enb, pcfichRx, pcfichHest, nest);cfi = lteCFIDecode(cfiBits); % Get CFIif (isfield(enb,'CFI') && cfi~=enb.CFI)release(pdcchConstDiagram);endenb.CFI = cfi;fprintf('Decoded CFI value: %d\n\n', enb.CFI);   if (strcmpi(enb.DuplexMode,'TDD'))tddConfigs = [1 6 0];elsetddConfigs = 0; % not used for FDD, only used to control while loopend    dci = {};while (isempty(dci) && ~isempty(tddConfigs))% Configure TDD uplink-downlink configurationif (strcmpi(enb.DuplexMode,'TDD'))enb.TDDConfig = tddConfigs(1);endtddConfigs(1) = [];        pdcchIndices = ltePDCCHIndices(enb); % Get PDCCH indices[pdcchRx, pdcchHest] = lteExtractResources(pdcchIndices, rxsubframe, hest);% Decode PDCCH and plot constellation[dciBits, pdcchSymbols] = ltePDCCHDecode(enb, pdcchRx, pdcchHest, nest);step(pdcchConstDiagram, pdcchSymbols);fprintf('PDCCH search for SI-RNTI...\n\n');pdcch = struct('RNTI', 65535);  dci = ltePDCCHSearch(enb, pdcch, dciBits); % Search PDCCH for DCI                end% If DCI was decoded, proceed with decoding PDSCH / DL-SCHif ~isempty(dci)dci = dci{1};fprintf('DCI message with SI-RNTI:\n');disp(dci);% Get the PDSCH configuration from the DCI[pdsch, trblklen] = hPDSCHConfiguration(enb, dci, pdcch.RNTI);pdsch.NTurboDecIts = 5;fprintf('PDSCH settings after DCI decoding:\n');disp(pdsch);fprintf('Decoding SIB1...\n\n');        % Get PDSCH indices[pdschIndices,pdschIndicesInfo] = ltePDSCHIndices(enb, pdsch, pdsch.PRBSet);[pdschRx, pdschHest] = lteExtractResources(pdschIndices, rxsubframe, hest);% Decode PDSCH [dlschBits,pdschSymbols] = ltePDSCHDecode(enb, pdsch, pdschRx, pdschHest, nest);% Decode DL-SCH with soft buffer input/output for HARQ combiningif ~isempty(decState)fprintf('Recombining with previous transmission.\n\n');end        [sib1, crc, decState] = lteDLSCHDecode(enb, pdsch, trblklen, dlschBits, decState);% Compute PDSCH EVMrecoded = lteDLSCH(enb, pdsch, pdschIndicesInfo.G, sib1);remod = ltePDSCH(enb, pdsch, recoded);[~,refSymbols] = ltePDSCHDecode(enb, pdsch, remod);release(pdschEVM);[rmsevm,peakevm] = step(pdschEVM, refSymbols{1}, pdschSymbols{1});fprintf('PDSCH RMS EVM: %0.3f%%\n',rmsevm);fprintf('PDSCH Peak EVM: %0.3f%%\n\n',peakevm);fprintf('SIB1 CRC: %d\n',crc);if crc == 0fprintf('Successful SIB1 recovery.\n\n');elsefprintf('SIB1 decoding failed.\n\n');endelse% indicate that DCI decoding failed fprintf('DCI decoding failed.\n\n');end% Update channel estimate plot figure(channelFigure);surf(abs(hest(:,:,1,1)));hSIB1RecoveryExamplePlots(channelFigure);channelFigure.CurrentAxes.XLim = [0 size(hest,2)+1];channelFigure.CurrentAxes.YLim = [0 size(hest,1)+1];   % Skip 2 frames and try SIB1 decoding again, or terminate if we% have less than 2 frames left. if (size(rxgrid,2)>=(L*20))rxgrid(:,1:(L*20),:) = [];   % Remove 2 more frameselserxgrid = []; % Less than 2 frames leftendenb.NFrame = enb.NFrame+2;endfigure('Position',[0 0 800 600])
plot(abs(hest(:,1,1,1)),'b-')
hold on
plot(abs(hest(:,1,2,1)),'r-.')
plot(abs(hest(:,1,1,2)),'k--')
plot(abs(hest(:,1,2,2)),'m.')
hold off
grid on
m = max(reshape(abs(hest(:,1,:,:)),[],1));
axis([0 size(hest,1)+1 0 m*1.3])
title('Channel Estimate for First OFDM Symbol')
xlabel('Subcarrier Index')
ylabel('Magnitude of Estimated Channel Coefficient')
legend('TX1 to RX1','TX1 to RX2', ...'TX2 to RX1','TX2 to RX2', ...'Location', 'northeast')

利用matlab和SDR实现LTE信号的采集以及帧同步,MIB解码相关推荐

  1. LTE学习理解系列——利用matlab工具生成4G LTE信源

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 LTE学习理解系列--利用matlab工具生成4G LTE信源 前言 LTE工具箱的使用 直接使用函数 生成信源的采样率 总结 前言 ...

  2. 利用matlab命令画出以下信号的波形,MATLAB实验报告

    文档收集于互联网,已重新整理排版.word 版本可编辑,有帮助欢迎下载支持. 1文档来源为:从网络收集整理.word 版本可编辑. 实验一 名称:连续时间信号分析 姓名:王嘉琦 学号:0636 班级: ...

  3. 利用matlab低通滤波器滤除肌电信号

    使用低通滤波器滤除肌电信号的步骤如下: 首先,打开 MATLAB 并加载肌电信号数据. 然后,使用函数 "butter" 设计低通滤波器. 接着,使用函数 "filter ...

  4. 利用matlab与eeglab对EEG信号(脑电)进行处理分段与保存

    本文中的代码仅对eeg信号进行了筛通道,滤波,分段处理 如有其他要求,请在第一段代码中自行补充 %这个是对edf文件处理的代码进化过程,每一段都是对前一段的提升 %用井号框起来的部分是成功后的代码 % ...

  5. 信号与系统:利用Matlab实现两个信号的卷积

    在泛函分析中,卷积.旋积或摺积(英语:Convolution)是通过两个函数f 和g 生成第三个函数的一种数学算子,表征函数f 与g经过翻转和平移的重叠部分函数值乘积对重叠长度的积分.卷积积分是一种特 ...

  6. 利用matlab对滤波器频率特性分析

    [设计目标]对双二阶环路滤波器进行时频域分析和处理的基本方法 [设计工具]MATLAB[设计要求] 1)分析典型的双二阶环路滤波器电路:低通.高通.带通.带阻 2)理论分析各滤波电路的系统函数 3)利 ...

  7. 在matlab中实现累乘,如何利用matlab设计一个线性相位FIR带通滤波器,并在FPGA上实现...

    设计要求 利用matlab设计一个线性相位FIR带通滤波器,并在FPGA上实现. 1.滤波器指标:过渡带带宽分别为100~300HZ,500~700HZ,阻带允许误差为0.02,通带允许误差为0.01 ...

  8. 数字图像处理拓展题目——利用Matlab实现动态目标检测 二帧差法、ViBe法、高斯混合模型法,可应用于学生递东西行为检测

    1.二帧差法实现动态目标检测 先上效果图: 利用GUI界面显示出来效果图为: 实现流程 1.利用matlab中的VideoReader函数读取视频流. 2.帧差法:获得视频帧数,用for循环对图像每相 ...

  9. 幅度调制信号 matlab,《利用MATLAB实现信号的幅度调制与解调.doc

    <利用MATLAB实现信号的幅度调制与解调 课程设计论文 姓名:姜勇 学院:机电与车辆工程学院 专业:电子信息工程2班 学号:1665090208 安徽科技学院 学年第 学期 < > ...

最新文章

  1. 操作系统面试知识点总结2
  2. Knative 快捷操作命令 Kn 介绍
  3. React 等框架使用 index 做 key 的问题
  4. (stl排序+检索)大理石在哪
  5. Copy++ 复制 PDF、CAJ 内容时,自动删除空格、空行,以及自动翻译[Win]
  6. TJU 2248. Channel Design 最小树形图
  7. Qt Quick QMl学习笔记 之图片浏览器
  8. 168输出为861java_AcWing 861. 二分图的最大匹配-java-关键处注释
  9. 仿造小红书页面代码html,jQuery仿小红书登录页,背景图垂直循环滚动登录页,向上循环滚动的动画,实现一张背景图片的无缝向上循环js滚动...
  10. mysql 额外内存池_MySQL探秘(三):InnoDB的内存结构和特性
  11. java string 栈_Java堆和栈的区别(String类)
  12. Oracle体系结构三(学习笔记)
  13. django migration使用指南
  14. 拉普拉斯分布_理解拉普拉斯特征映射中的优化问题的约束条件
  15. 毕业设计 基于STM32停车管理系统 - 物联网
  16. 辽宁大连最好的计算机大学排名,2020年大连市最好大学排行榜:20所高校上榜,东北财经大学居第二...
  17. 信息技术领域会议(技术领域和非技术领域)
  18. 终极 Shell on-zshrc
  19. html中如何放音乐 和视频播放器,HTML5培训之HTML5音乐播放器和视频播放器分享
  20. 计算电话费练习【20171121】

热门文章

  1. 这才是真正的电子科大
  2. imfilter函数详解
  3. 优先队列练习 黑匣子
  4. java科技论文20000字_科学素养论文范文 科学素养方面有关论文参考文献范文2万字...
  5. 基于Tensorflow卷积神经网络(CNN)的人脸年龄和性别检测系统
  6. 【双目视觉】双目矫正
  7. Python处理Excel(4):正则查找Excel复制行
  8. JavaScript断点调试与console.log(..)输出不一致
  9. Python 安装 Crypto
  10. 采购价格标准法和标准成本