Simple baseband TRx design concept in matlab

6 views (last 30 days)
Greeting everyone.
I am trying some experiments on how to process the data through wireless communication with the simple communication link below.
Source (bit stream) > Tx modulator > Tx filter > AWGN channel > Rx filter > Rx demodulator > Receiver bit (bit stream)
So, my expectation is that the receiver site should demod and receive the correct data from the source.
Example: Input data "111100001111"; the receiver should demod the data as "111100001111".
Anyway, what I got when I checked the output demoded message was that the data was not the same as the input.
Example: Input "111100001111"; demod data : "111000011111" which has an error on bit no 4 and bit no 8
Below are the matlab code and input parameters that I set on my experiments.
load("Data.mat") % Input data
numBits = length(B4mod_bit);
modOrder = 2; % for BPSK
bitsPerSymbol = log2(modOrder) % modOrder = 2^bitsPerSymbol
txFilt = comm.RaisedCosineTransmitFilter; % create Tx Raised Cosine Object
rxFilt = comm.RaisedCosineReceiveFilter; % create Rx Raised Cosine Object
dbpskmod = comm.DBPSKModulator(pi); % create dbpsk modulation object
dpbpskdemod = comm .DBPSKDemodulator(pi,"OutputDataType","Full precision"); % create dbpsk demodulation object
modOut = dbpskmod(B4mod_bit); %modulate input bits
txFiltOut = txFilt(modOut); % add tx filter after modulate
SNR = 35; % dB
chanOut = awgn(txFiltOut,SNR,"measured"); % add awgn channel
rxFiltOut = rxFilt(chanOut); % filter the receive signal
demodOut = dpbpskdemod(rxFiltOut) % demod the signal
numofBitErrors=nnz(B4mod_bit ~= demodOut) % compare Input and demod output here
% calculate the bit error rate follow from Wireless communication On ramp excersise
delayInSymbols=txFilt.FilterSpanInSymbols/2+rxFilt.FilterSpanInSymbols/2
delayInBits=delayInSymbols * bitsPerSymbol
srcAligned=B4mod_bit(1:(end-delayInBits))
demodAligned=demodOut((delayInBits+1):end)
numBitErrors=nnz(srcAligned ~= demodAligned)
BER=numBitErrors/length(srcAligned)
Source bit / Bit per frame : 208 bits
Modulation type : DBPSK with Pi phase rotation
bit rate / Symbol rate : 1 bps
Tx filter :
Shape: 'Square root'
RolloffFactor: 0.2000
FilterSpanInSymbols: 10
OutputSamplesPerSymbol: 8
Gain: 1
Rx filter :
Shape: 'Square root'
RolloffFactor: 0.2000
FilterSpanInSymbols: 10
InputSamplesPerSymbol: 8
DecimationFactor: 8
DecimationOffset: 0
Gain: 1
Can anyone please give me some idea what is happening?
Any feedback is appreciated.
Best Regards,
Fumihiko Sato
  2 Comments
Santosh Fatale
Santosh Fatale on 17 Nov 2022
Hi Fumihiko,
Could you please share "Data.mat" file?
Fumihiko Sato
Fumihiko Sato on 17 Nov 2022
Dear Santosh,
Please find the attached for the "Data.mat" file.
The data is the column vector of data frame that included the 19 bits header preamble 0b1010101010101010101.
The rest are data.
Best Regards,
Fumihiko

Sign in to comment.

Answers (1)

Santosh Fatale
Santosh Fatale on 24 Nov 2022
Hi Fumihiko,
It is my understanding that you are talking about the mismatch happening for the variable "numofBitErrors". Note that each of the Tx and Rx filters introduces a delay of (Filter Span in Symbol/2) * (Number of Bits/Symbol). You should not compare modulated and demodulated bits without taking the respective delay into account.
The same delay factor is taken into consideration in the second part of the code, where you followed the bit error calculation as per the Wireless Communication Onramp exercise.
You can also check out the following MATLAB Answer for more information on end-to-end implementation of wireless communication systems.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!