Модуляция символов в 4G (lteSymbolModulate)
29.05.2022
Доброго времени суток, возникла проблема в том, что бы переделать верхний код под модуляцию символов для 4G, используя toolbox lte. То бишь нужно вместо nrSymbolModulate/Demodulate использовать lteSym...
Доброго времени суток, возникла проблема в том, что бы переделать верхний код под модуляцию символов для 4G, используя toolbox lte. То бишь нужно вместо nrSymbolModulate/Demodulate использовать lteSymbolModulate/Demodulate, но графики почему то не получаются (Нижний код). Очень нужна помощь, буду благодарен.
clear all;
clc;
N = 24e5;
%========================================================================
%%%%%%%%%%%%%%%%%%%%%%%%% BPSK MODULATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% 1. BER OF AWGN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Step 1: Generating random binary data
x = randn(1,N) >= 0;
SNR_all = -5:1:10;
BER_all = zeros(1,length(SNR_all));
%%%%%%%%%%%%%%%%%%%%%%%% 16-QAM MODULATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x_16QAM = nrSymbolModulate(x','16QAM');
BER_all_16QAM = zeros(1,length(SNR_all));
j = 1;
for SNR = -5:1:10
% Adding noise to transmitted signal without fading
sigma = sqrt(1/(2*(10^(SNR/10))));
noise = sigma*randn(1,length(x_16QAM));
rec = x_16QAM' + noise;
% Step 4:
% Setting the threshold and demodulating
rec_dec = nrSymbolDemodulate(rec','16QAM','DecisionType','Hard');
BER_count = sum(xor(x,rec_dec'));
BER_all_16QAM(j) = BER_count/length(x);
j = j + 1;
end
figure(2)
subplot(2,2,1)
semilogy(SNR_all,BER_all_16QAM,'lineWidth',1.5);
xlabel('SNR per bit (E_b/N_o) dB');
ylabel('Bit Error Rate(BER) in dB');
title(' BER vs (E_b/N_o) for 16QAM in AWGN channel')
grid on;
clear all;
clc;
% Date 2/19/2021
% Yashwanth
% Requires 5G ToolBOX
% Params
% Input bits
N = 24e3;
%========================================================================
%%%%%%%%%%%%%%%%%%%%%%%%% BPSK MODULATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% 1. BER OF AWGN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Step 1: Generating random binary data
x = randn(1,N) >= 0;
SNR_all = 0:1:30;
BER_all = zeros(1,length(SNR_all));
%%%%%%%%%%%%%%%%%%%%%%%% 16-QAM MODULATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x_16QAM = lteSymbolModulate(x,'16QAM');
BER_all_16QAM = zeros(1,length(SNR_all));
j = 1;
for SNR = 0:1:30
% Adding noise to transmitted signal without fading
sigma = sqrt(1/(2*(10^(SNR/10))));
noise = sigma*randn(1,length(x_16QAM));
rec = x_16QAM' + noise;
% Step 4:
% Setting the threshold and demodulating
rec_dec = lteSymbolDemodulate(rec,'16QAM');
BER_count = sum(xor(x,rec_dec'));
BER_all_16QAM(j) = BER_count/length(x);
j = j + 1;
end
figure(2)
subplot(2,2,1)
semilogy(SNR_all,BER_all_16QAM,'lineWidth',1.5);
xlabel('SNR per bit (E_b/N_o) dB');
ylabel('Bit Error Rate(BER) in dB');
title(' BER vs (E_b/N_o) for 16QAM in AWGN channel')
grid on;
Комментарии
Поставье в свойствах lteSymbolDemodulate жесткую демодуляцию, либо нужно дополнительное устройство, для принятия решения по мягкому порогу.