Demodulation error QAM-16, can't make BER=0
15 次查看(过去 30 天)
显示 更早的评论
%I can't make BER=0, I think, something is wrong with demodulation, in the demodulated sequence there are only numbers 5, 7, 13, 15. Now BER is equal to about half of all bit values, so what can I do to resolve this and make BER=0?
clc
close all
clear all
M = 16;
L=10000;
T=10;
W=43; %SNR
bits1 = randi([0 M-1], 1, L);
bits2 = randi([0 3], 1, L/T);
mod1 = qammod(bits1, M,'UnitAveragePower', true);
% scatterplot(mod1)
mod2 = qammod(bits2, 4, 'UnitAveragePower',true);
% scatterplot(mod2)
for i = 1:length(bits2)
sym(i,:)=[mod1((i-1)*T+1:i*T) mod2(i)];
end
f=0;
for k=1:L/T
for j=1:T+1
f=f+1;
symbols(f)=sym(k,j);
end
end
% scatterplot(symbols)
% symbols = awgn(symbols,W,"measured");
pnoise = comm.PhaseNoise('Level',[-70 -104 -110],'FrequencyOffset',[1e4 1e5 2e5], 'SampleRate', 28e6);
symbols2 = pnoise([zeros(1e5,1);symbols']);
% symbols2 = pnoise(symbols);
fc = 1e6; % Carrier frequency in Hz
fs = 28e6; % Sample rate in Hz.
phNzLevel = [-70 -104 -110]; % in dBc/Hz
phNzFreqOff = [1e4 1e5 2e5]; % in Hz
Nspf = 6e6; % Number of Samples per frame
freqSpan = 400e3; % in Hz, for spectrum computation
sinewave = dsp.SineWave( ...
Amplitude=1, ...
Frequency=fc, ...
SampleRate=fs, ...
SamplesPerFrame=Nspf, ...
ComplexOutput=true);
pnoise = comm.PhaseNoise( ...
Level=phNzLevel, ...
FrequencyOffset=phNzFreqOff, ...
SampleRate=fs);
sascopeRBW100 = spectrumAnalyzer( ...
SampleRate=fs, ...
Method="welch", ...
FrequencySpan="Span and center frequency", ...
CenterFrequency=fc, ...
Span=freqSpan, ...
RBWSource="Property", ...
RBW=100, ...
SpectrumType="Power density", ...
SpectralAverages=10, ...
SpectrumUnits="dBW", ...
YLimits=[-150 10], ...
Title="Resolution Bandwidth 100 Hz", ...
ChannelNames={'signal','signal with phase noise'}, ...
Position=[79 147 605 374]);
x = sinewave();
y = pnoise(x);
sascopeRBW100(x,y)
symbols2 = symbols2(1e5+1:end);
prim(1,:)=symbols2(1:T);
for i = 1:length(bits2)-1
prim(i+1,:)=symbols2(i*T+i+1:i*T+i+T);
end
for b = 1:length(mod2)
qam4(b)=symbols2((T+1)*b);
end
h=0;
for u=1:L/T
for l=1:T
h=h+1;
priem(h)=prim(u,l);
end
end
for g = 1:L/T
phase_error(g) = angle(qam4(g) / mod2(g));
compensated4(g) = qam4(g) .* exp(-1i * phase_error(g));
end
for v = 1:L/T
phase_errorM((v-1)*T+1:v*T)=phase_error(v);
end
for f = 1:L
compensatedM(f) = priem(f) .* exp(-1i*phase_errorM(f));
end
demod=qamdemod(compensatedM, M, 'bin','OutputType','bit');
% scatterplot(qam4)
% scatterplot(symbols2)
% scatterplot(compensatedM)
[number,ratio]=biterr(bits1,demod);
evm = lteEVM(demod,bits1);
figure('Position',[200 200 1080 540])
subplot(1,2,1)
scatter(real(symbols2),imag(symbols2),300,".")
subplot(1,2,2)
scatter(real(compensatedM),imag(compensatedM),300,".")
1 个评论
Saurav
2024-8-23,10:00
Hi @Kazantcev
There is a mismatch in the format between bits1 and demod. The bits1 array contains integer symbols ranging from 0 to 15, while demod is a binary array representing bits. This mismatch leads to an incorrect calculation of the bit error rate (BER) by the biterr function.
To resolve this issue, you need to convert bits1 into a binary format before comparing it with demod. Ensure that the rest of the algorithm is correct as well.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 PHY Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!