dvbs2BitRecover
Syntax
Description
[
recovers user packets (UPs) or a continuous data stream, BITS
,NUMFRAMESLOST
] = dvbs2BitRecover(RXFRAME
,NVAR
)BITS
, and the
number of lost baseband frames, NUMFRAMESLOST
. Input
RXFRAME
is the received complex in-phase quadrature (IQ) symbols in
the form of physical layer (PL) frames of a Digital Video Broadcasting Satellite Second
Generation (DVB-S2) transmission. Input NVAR
is the noise variance
estimate, used to calculate soft bits.
[
also returns the UP cyclic redundancy check (CRC) status.BITS
,NUMFRAMESLOST
,PKTCRCSTATUS
] = dvbs2BitRecover(RXFRAME
,NVAR
)
Examples
Recover Data Bits from Transport Stream DVB-S2 Transmission
Recover user packets (UPs) for multiple physical layer (PL) frames in a single transport stream Digital Video Broadcasting Satellite Second Generation (DVB-S2) transmission.
This example uses MAT-files with LDPC parity matrices. If the MAT-files are not available on the path, download and unzip the MAT-files by entering this code at the MATLAB command prompt.
if ~exist('dvbs2xLDPCParityMatrices.mat','file') if ~exist('s2xLDPCParityMatrices.zip','file') url = 'https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip'; websave('s2xLDPCParityMatrices.zip',url); unzip('s2xLDPCParityMatrices.zip'); end addpath('s2xLDPCParityMatrices'); end
Specify the number of PL frames per stream. Create a DVB-S2 System object.
nFrames = 2; s2WaveGen = dvbs2WaveformGenerator;
Create the bit vector of information bits, data
, of concatenated TS UPs.
syncBits = [0 1 0 0 0 1 1 1]'; % Sync byte for TS packet is 47 Hex pktLen = 1496; % UP length without sync bits is 1496 numPkts = s2WaveGen.MinNumPackets*nFrames; txRawPkts = randi([0 1],pktLen,numPkts); txPkts = [repmat(syncBits,1,numPkts); txRawPkts]; data = txPkts(:);
Generate the DVB-S2 time-domain waveform using the input information bits. Flush the transmit filter to handle the filter delay and recover the complete last frame.
txWaveform = [s2WaveGen(data); flushFilter(s2WaveGen)];
Add additive white Gaussian noise (AWGN) to the generated waveform.
sps = s2WaveGen.SamplesPerSymbol;
EsNodB = 1;
snrdB = EsNodB - 10*log10(sps);
rxIn = awgn(txWaveform,snrdB,'measured');
Create a raised cosine receiver filter.
rxFilter = comm.RaisedCosineReceiveFilter( ... 'RolloffFactor',s2WaveGen.RolloffFactor, ... 'InputSamplesPerSymbol',sps,... 'DecimationFactor',sps); s = coeffs(rxFilter); rxFilter.Gain = sum(s.Numerator);
Apply matched filtering and remove the filter delay.
filtOut = rxFilter(rxIn); rxFrame = filtOut(rxFilter.FilterSpanInSymbols+1:end);
Recover UPs. Display the number of frames lost and the UP cyclic redundancy check (CRC) status.
[bits,FramesLost,pktCRCStat] = dvbs2BitRecover(rxFrame,10^(-EsNodB/10)); disp(FramesLost)
0
disp(pktCRCStat)
{20×1 logical}
Recover Data Bits from Generic Stream DVB-S2 Transmission with Early Termination Enabled
Recover user bits in a multi-input generic stream (GS) Digital Video Broadcasting Satellite Second Generation (DVB-S2) transmission with variable modulation and coding scheme.
This example uses MAT-files with LDPC parity matrices. If the MAT-files are not available on the path, download and unzip the MAT-files by entering this code at the MATLAB command prompt.
if ~exist('dvbs2xLDPCParityMatrices.mat','file') if ~exist('s2xLDPCParityMatrices.zip','file') url = 'https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip'; websave('s2xLDPCParityMatrices.zip',url); unzip('s2xLDPCParityMatrices.zip'); end addpath('s2xLDPCParityMatrices'); end
Specify the number of physical layer (PL) frames per stream.
nFrames = 1;
Create a DVB-S2 System object with variable coding and modulation configuration for a multi-input GS. Specify the modulation scheme and forward error correction (FEC) rate (MODCOD) and the data field length (DFL).
s2WaveGen = dvbs2WaveformGenerator; s2WaveGen.StreamFormat = "GS"; s2WaveGen.NumInputStreams = 3; s2WaveGen.MODCOD = [10 15 6]; % QPSK 8/9, 8PSK 5/6, and QPSK 2/3 s2WaveGen.DFL = [44500 51387 42960];
Create a bit vector of input information bits for each input stream.
data = cell(s2WaveGen.NumInputStreams,1); for i = 1:s2WaveGen.NumInputStreams data{i} = randi([0 1],s2WaveGen.DFL(i)*nFrames,1); end
Generate the DVB-S2 time-domain waveform with the input information bits. Flush the transmit filter to handle the filter delay and recover the complete frame.
txWaveform = [s2WaveGen(data); flushFilter(s2WaveGen)];
Add additive white Gaussian noise (AWGN) to the generated waveform. Specify the samples per symbol for the baseband filter.
sps = s2WaveGen.SamplesPerSymbol;
EsNodB = 10;
snrdB = EsNodB - 10*log10(sps);
rxIn = awgn(txWaveform,snrdB,'measured');
Create a raised cosine receiver filter.
rxFilter = comm.RaisedCosineReceiveFilter( ... 'RolloffFactor',s2WaveGen.RolloffFactor, ... 'InputSamplesPerSymbol',sps,... 'DecimationFactor',sps); s = coeffs(rxFilter); rxFilter.Gain = sum(s.Numerator);
Apply matched filtering and remove the filter delay.
filtOut = rxFilter(rxIn); rxFrame = filtOut(rxFilter.FilterSpanInSymbols+1:end);
Recover user bits. Enable early termination of the low-density parity-codes (LDPC) decoder.
[bits,FramesLost] = dvbs2BitRecover(rxFrame,10^(-EsNodB/10),1);
Display the number of frames lost and the number of bit errors in each stream.
fprintf('Number of frames lost = %d\n',FramesLost)
Number of frames lost = 0
for i = 1:s2WaveGen.NumInputStreams fprintf('Number of bit errors in stream %d = %d\n',i, ... sum(data{i}~=bits{i})) end
Number of bit errors in stream 1 = 0 Number of bit errors in stream 2 = 0 Number of bit errors in stream 3 = 0
Recover Data Bits from Transport Stream DVB-S2 Transmission with ISSYI Enabled
Recover user packets (UPs) in a multi-input transport stream (TS) Digital Video Broadcasting Satellite Second Generation (DVB-S2) transmission with constant coding and modulation.
This example uses MAT-files with LDPC parity matrices. If the MAT-files are not available on the path, download and unzip the MAT-files by entering this code at the MATLAB command prompt.
if ~exist('dvbs2xLDPCParityMatrices.mat','file') if ~exist('s2xLDPCParityMatrices.zip','file') url = 'https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip'; websave('s2xLDPCParityMatrices.zip',url); unzip('s2xLDPCParityMatrices.zip'); end addpath('s2xLDPCParityMatrices'); end
Specify the number of physical layer (PL) frames per stream.
numFrames = 1;
Create a DVB-S2 System object with constant coding and modulation configuration for a multi-input TS. Specify a short forward error correction (FEC) frame format and enable the input stream synchronization (ISSY).
s2WaveGen = dvbs2WaveformGenerator; s2WaveGen.NumInputStreams = 3; s2WaveGen.FECFrame = "short"; s2WaveGen.MODCOD = 10; % QPSK 8/9 s2WaveGen.DFL = 13920; s2WaveGen.ISSYI = true;
Create a bit vector of information bits of concatenated TS UPs.
syncBits = [0 1 0 0 0 1 1 1]'; % Sync byte for TS packet is 47 Hex pktLen = 1496; % UP length without sync bits is 1496 data = cell(1,s2WaveGen.NumInputStreams); for i = 1:s2WaveGen.NumInputStreams numPkts = s2WaveGen.MinNumPackets(i)*numFrames; txRawPkts = randi([0 1],pktLen,numPkts); ISSY = randi([0 1],16,numPkts); % ISCRFormat is 'short' by default % 'short' implies the default length of ISSY as 2 bytes txPkts = [repmat(syncBits,1,numPkts); txRawPkts; ISSY]; % ISSY is appended at the end of UP data{i} = txPkts(:); end
Generate the DVB-S2 time-domain waveform using the input information bits. Flush the transmit filter to handle the filter delay and recover the complete frame.
txWaveform = [s2WaveGen(data); flushFilter(s2WaveGen)];
Add additive white Gaussian noise (AWGN) to the generated waveform. Specify the samples per symbol for the baseband filter.
sps = s2WaveGen.SamplesPerSymbol;
EsNodB = 12;
snrdB = EsNodB - 10*log10(sps);
rxIn = awgn (txWaveform,snrdB,'measured');
Create a raised cosine receiver filter.
rxFilter = comm.RaisedCosineReceiveFilter( ... 'RolloffFactor',s2WaveGen.RolloffFactor, ... 'InputSamplesPerSymbol',sps,... 'DecimationFactor', sps); s = coeffs(rxFilter); rxFilter.Gain = sum(s.Numerator);
Apply matched filtering and remove filter delay.
filtOut = rxFilter(rxIn); rxFrame = filtOut(rxFilter.FilterSpanInSymbols+1:end);
Recover UPs. Display the number of frames lost and the number of bit errors in each stream.
[bits,FramesLost,pktCRCStat] = dvbs2BitRecover(rxFrame,10^(-EsNodB/10));
fprintf('Number of frames lost = %d\n',FramesLost)
Number of frames lost = 0
for i = 1:s2WaveGen.NumInputStreams fprintf('Number of bit errors in stream %d = %d\n',i, ... numel(pktCRCStat{i})-sum(pktCRCStat{i})) end
Number of bit errors in stream 1 = 0 Number of bit errors in stream 2 = 0 Number of bit errors in stream 3 = 0
Input Arguments
RXFRAME
— Received IQ symbols from PL frames of DVB-S2 transmission
column vector
Received IQ symbols from PL frames of a DVB-S2 single-input or multi-input
transmission, specified as a column vector. RXFRAME
can contain one
or multiple PL frames.
The length of RXFRAME
depends on the value of the properties
FECFrame
, MODCOD
, and
HasPilots
of the dvbs2WaveformGenerator
System object™.
Data Types: double
Complex Number Support: Yes
NVAR
— Noise variance estimate
nonnegative scalar
Noise variance estimate that the function adds to the input IQ symbols, specified as
a nonnegative scalar. NVAR
is used as a scaling factor to calculate
the soft bits from the IQ symbols.
When you specify NVAR
as 0
, the function
uses a value of 1e-5, which corresponds to a signal-to-noise ratio (SNR) of 50
dB.
Data Types: double
EARLYTERM
— Flag for early termination of LDPC decoder
0
or false
(default) | 1
or true
Flag for early termination of the LDPC decoder when all parity-checks are satisfied,
specified as a numeric or logical value of 1
(true
) or 0
(false
). When set
to 1
(true
), the LDPC decoder is terminated when
all parity checks are satisfied.
When you set this value to 0
(false
), the
maximum decoding iteration limit is 50.
Data Types: logical
Output Arguments
BITS
— Recovered data bits
cell array of column vectors
Recovered data bits, returned as a cell array of column vectors. Each element of the
cell array is of data type int8
. This output can be either UPs or
generic data stream, depending of the StreamFormat
property of the
dvbs2WaveformGenerator
System object.
For a multi-input stream transmission, each element of the cell array corresponds to an individual input stream.
Data Types: cell
NUMFRAMESLOST
— Number of lost baseband frames
nonnegative integer
Number of lost baseband frames, returned as a nonnegative integer. If the baseband header CRC fails, the frame is considered lost.
Data Types: double
PKTCRCSTATUS
— UP CRC status
cell array of column vectors
UP CRC status, returned as a cell array of column vectors. Each element of the cell
array is of data type logical
. For a multi-input stream transmission,
each element of the cell array corresponds to an individual input stream.
Dependencies
PKTCRCSTATUS
applies for only the input streams where the
value of the UPL
property of
dvbs2WaveformGenerator
System object is nonzero.
Data Types: cell
References
[1] ETSI Standard EN 302 307-1 V1.4.1(2014-11). Digital Video Broadcasting (DVB); Second Generation Framing Structure, Channel Coding and Modulation Systems for Broadcasting, Interactive Services, News Gathering and other Broadband Satellite Applications (DVB-S2).
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)