OQPSK modulation / demodulation errors

5 ビュー (過去 30 日間)
Clint Thomas
Clint Thomas 2024 年 3 月 8 日
編集済み: Clint Thomas 2024 年 3 月 20 日
Hello,
I wrote this code trying to characterize BER vs. Eb/N0 for RC OQPSK which results in 50% errors (basically meaning the process is completely random) for all Eb/N0 values. That tells me the modulator/demodulator is not working.
close all
clear
clc
PulseShape = 'Normal raised cosine';
RolloffFactor = 0.25;
FilterSpanInSymbols = 4;
oqpskmod = comm.OQPSKModulator('BitInput',true);
oqpskdemod = comm.OQPSKDemodulator('BitOutput',true);
EbNo = [0:10]';
errorTot = zeros(length(EbNo),1);
txData = csvread("PRN15_Binary.csv")';
Error using csvread
File not found.
txData = txData(1:end-1);
txData = [1,1,1,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1]';
for i = 1:length(EbNo)
channel = comm.AWGNChannel('EbNo',EbNo(i),'BitsPerSymbol',2);
modSig = oqpskmod(txData);
rxSig = channel(modSig);
rxData = oqpskdemod(rxSig);
error = length(txData) - sum(txData==rxData);
errorTot(i) = errorTot(i) + error;
end
errorTot
errorTot = zeros(length(EbNo),1);

回答 (1 件)

Andrew Reibold
Andrew Reibold 2024 年 3 月 8 日
It seems like there might be a couple of issues in your code.
1. BitInput/BitsPerSymbol Mismatch:
You have set 'BitInput' to true in the modulator, which means it expects input in bits. However, in the channel, you specified 'BitsPerSymbol' as 2. Ensure consistency in bit handling between the modulator and the channel.
2. AWGN Channel Initialization:
It's better to initialize the AWGN channel outside the loop to keep the noise consistent for each Eb/N0 value.
3. Data Size Mismatch:
Make sure the length of `txData` matches the number of bits required for the modulation scheme. For OQPSK, the number of bits per symbol is typically 2.
Here's an adjusted version:
close all
clear
clc
PulseShape = 'Normal raised cosine';
RolloffFactor = 0.25;
FilterSpanInSymbols = 4;
oqpskmod = comm.OQPSKModulator('BitInput', true, 'PulseShape', PulseShape, 'RolloffFactor', RolloffFactor, 'FilterSpanInSymbols', FilterSpanInSymbols);
oqpskdemod = comm.OQPSKDemodulator('BitOutput', true, 'PulseShape', PulseShape, 'RolloffFactor', RolloffFactor, 'FilterSpanInSymbols', FilterSpanInSymbols);
EbNo = [0 0:20]';
errorTot = zeros(length(EbNo), 1);
% Initialize AWGN channel outside the loop
channel = comm.AWGNChannel('BitsPerSymbol', 2);
%Temporarily Commenting out CVS Read
%txData = csvread("PRN15_Binary.csv")';
%txData = txData(1:end-1);
txData = [1,1,1,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1]';
for i = 1:length(EbNo)
% Set EbNo for each iteration
channel.EbNo = EbNo(i);
modSig = oqpskmod(txData);
rxSig = channel(modSig);
rxData = oqpskdemod(rxSig);
% Count errors
error = sum(txData ~= rxData);
errorTot(i) = errorTot(i) + error;
end
errorTot
(This code ran without error in Matlab 2023B.)
This code possibly addresses the mentioned issues... Let me know if this answered your question, resulted in follow up questions, or if your quesiton was totally misunderstood.

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by