ofdmEqualize
Equalize OFDM signals
Syntax
Description
[
returns equalized symbols eqsym
,csi
]= ofdmEqualize(rxsym
,hest
,nvar
)eqsym
and soft channel state information
csi
after performing minimum mean squared error (MMSE) equalization
on input OFDM symbols rxsym
. hest
specifies the
estimated channel information. nvar
specifies the estimated noise
variance.
Examples
OFDM Equalization for MIMO Channel
Equalize an OFDM signal filtered through a MIMO channel.
Define variables for a 2-by-4 MIMO system transmitting a 64-QAM signal that is OFDM modulated.
numTxAntenna = 2; numRxAntenna = 4; fftLen = 256; cpLen = 16; k = 6; % Bits per symbol for each OFDM data subcarrier modOrder = 2^k; % 64-QAM for k = 6 numOFDMSymbols = 8; SNRdB = 40;
Specify null indices for guard bands and a DC subcarrier.
ofdmNullIdx = [1:9 (fftLen/2+1) (fftLen-8+1:fftLen)]';
Apply QAM and OFDM modulation to random bit data.
numDataSubcarriers = fftLen-length(ofdmNullIdx); srcBits = randi([0,1], ... [numDataSubcarriers*log2(modOrder) numOFDMSymbols numTxAntenna]); ofdmData = qammod(srcBits,modOrder, ... InputType="bit", ... UnitAveragePower=true); txSignal = ofdmmod(ofdmData,fftLen,cpLen,ofdmNullIdx);
Filter the OFDM signal through a MIMO channel and add AWGN.
mimoChannel = comm.MIMOChannel( ... SampleRate=1e6, ... PathDelays=[3e-6 5e-6 8e-6], ... AveragePathGains=[1.2 0.5 0.1], ... MaximumDopplerShift=1, ... SpatialCorrelationSpecification="None", ... NumTransmitAntennas=numTxAntenna, ... NumReceiveAntennas=numRxAntenna, ... PathGainsOutputPort=true); [channelOut,pathGains] = mimoChannel(txSignal); rxSignal = awgn(channelOut,SNRdB,"measured");
Get a perfect channel estimate by using the channel filter coefficients and path gains from the comm.MIMOChannel System object™.
mimoChannelInfo = info(mimoChannel); pathFilters = mimoChannelInfo.ChannelFilterCoefficients; maxFilterLen = size(pathFilters,2); numPaths = size(pathGains,2); symLen = fftLen+cpLen; pathGainsLink = permute( ... pathGains((cpLen+1) + ... (0:(numOFDMSymbols-1))*symLen,:,:,:), ... [2 4 3 1]); h = zeros(maxFilterLen,numRxAntenna,numTxAntenna,numOFDMSymbols); for np = 1:numPaths h = h + ... bsxfun(@times,pathFilters(np,:).',pathGainsLink(np,:,:,:)); end impulseResponse = zeros( ... numOFDMSymbols*symLen,numRxAntenna,numTxAntenna); for n = 1:numOFDMSymbols idx = cpLen + (n-1)*symLen + (1:maxFilterLen); impulseResponse(idx,:,:) = impulseResponse(idx,:,:) + h(:,:,:,n); end H = zeros( ... numDataSubcarriers,numOFDMSymbols,numTxAntenna,numRxAntenna); for nt = 1:numTxAntenna H(:,:,nt,:) = ofdmdemod( ... impulseResponse(:,:,nt),fftLen,cpLen,cpLen,ofdmNullIdx); end hEst = reshape(H,[],numTxAntenna,numRxAntenna);
Demodulate and equalize the OFDM symbols.
rxSym = ofdmdemod(rxSignal,fftLen,cpLen,cpLen,ofdmNullIdx); eqSym = ofdmEqualize(rxSym,hEst,Algorithm="zf"); refConst = qammod(0:modOrder-1,modOrder,UnitAveragePower=true); constellationDiagram = comm.ConstellationDiagram( ... XLimits=[-2 2], ... YLimits=[-2 2], ... ReferenceConstellation=refConst); constellationDiagram(eqSym(:));
Show Equivalence of 2-D and 3-D Data Format for OFDM Equalization
Initialize variables for simulation of a MIMO system and a 120-resource-element subset of the OFDM subcarrier-symbol grid.
Nre = 120; Nt = 4; Nr = 8; nvar = 0.1;
Create random signals for a 2-D symbol array and a channel estimate.
rxsym2d = complex(randn(Nre,Nr),randn(Nre,Nr)); Hest = complex(randn(Nre,Nt,Nr),randn(Nre,Nt,Nr));
Apply OFDM equalization to the 2-D signal contained in an 120-by-8 symbol array.
[eqsym2d,csi2d] = ofdmEqualize(rxsym2d,Hest,nvar,DataFormat="2-D");
Reshape the 2-D signal to a 30-by-4-by-8 symbol array. Apply OFDM equalization to the 3-D signal. Compare the results of OFDM equalization for the 30-by-4-by-8 symbol array with OFDM equalization for the 120-by-8 symbol array. As the isequal
function result shows, the equalized symbols and soft channel state information returned for the 30-by-4-by-8 and 120-by-8 symbol arrays are equal.
rxsym3d = reshape(rxsym2d,30,4,Nr);
[eqsym3d,csi3d] = ofdmEqualize(rxsym3d,Hest,nvar,DataFormat="3-D");
isequal(eqsym3d,reshape(eqsym2d,30,4,Nt))
ans = logical
1
isequal(csi3d,csi2d)
ans = logical
1
Reshape the 2-D signal to a 60-by-2-by-8 symbol array. Apply OFDM equalization to the 3-D signal. Compare the results of OFDM equalization for the 60-by-2-by-8 symbol array with OFDM equalization for the 120-by-8 symbol array. As the isequal
function result shows, the equalized symbols and soft channel state information returned for the 60-by-2-by-8 and 120-by-8 symbol arrays are equal.
rxsym3d2 = reshape(rxsym2d,60,2,Nr);
[eqsym3d2,csi3d2] = ofdmEqualize(rxsym3d2,Hest,nvar,DataFormat="3-D");
isequal(eqsym3d2,reshape(eqsym2d,60,2,Nt))
ans = logical
1
isequal(csi3d2,csi2d)
ans = logical
1
Input Arguments
rxsym
— Received symbols
3-D array | 2-D array
Received symbols, specified as a 3-D or 2-D array.
If
DataFormat
is set to"3-D"
, the function expectsrxsym
to be specified as an NSC-by-NSymbols-by-NR array. NSC represents the number of OFDM subcarriers, NSymbols represents the number of OFDM symbols, and NR represents the number of receive antennas.If
DataFormat
is set to"2-D"
, the function expectsrxsym
to be specified as an NRE-by-NR array. NRE represents the number of resource elements in an irregular subset of the OFDM subcarrier symbol grid.
Data Types: double
| single
Complex Number Support: Yes
hest
— Channel estimate
3-D array
Channel estimate, specified as a 3-D array.
If
DataFormat
is set to"3-D"
, the function expectshest
to be an NSC-by-NT-by-NR or an (NSC×NSymbols)-by-NT-by-NR array.If
hest
is an NSC-by-NT-by-NR array, all OFDM symbols inrxsym
are equalized by the same channel estimate. NSC represents the number of OFDM subcarriers, NT represents the number of transmit antennas, and NR represents the number of receive antennas.If
hest
is an (NSC×NSymbols)-by-NT-by-NR array, each OFDM symbol inrxsym
is equalized by the corresponding entry inhest
. NSymbols represents the number of OFDM symbols.
If
DataFormat
is set to"2-D"
, the function expectshest
to be an NRE-by-NT-by-NR array. Each OFDM symbol inrxsym
is equalized by the corresponding entry inhest
. NRE represents the number of resource elements in an irregular subset of the OFDM subcarrier symbol grid.
Data Types: double
| single
Complex Number Support: Yes
nvar
— Noise variance
0 (default) | nonnegative scalar
Noise variance estimate for MMSE equalization, specified as a nonnegative scalar.
Dependencies
The noise variance setting is used only when you set
Algorithm
to "mmse"
.
Data Types: double
| single
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: ofdmEqualize(rxsym,hest,DataFormat="2-D")
equalizes an
NRE-by-NR
input OFDM symbol array using the MMSE algorithm.
Algorithm
— Equalization algorithm
"mmse"
(default) | "zf"
Equalization algorithm, specified as "mmse"
or
"zf"
.
When this argument is set to
"mmse"
, the function equalizes using the MMSE algorithm.When this argument is set to
"zf"
, the function equalizes using the zero-forcing algorithm. When using the zero-forcing algorithm, thenvar
argument value is ignored.
DataFormat
— Format of signals
"3-D"
(default) | "2-D"
Format of the signals, specified as "3-D"
or
"2-D"
.
When this argument is set to "3-D"
, OFDM subcarriers and OFDM
symbols use two separate dimensions in the representation of
rxsym
and eqsym
.
The
rxsym
input must be an NSC-by-NSymbols-by-NR array.The
eqsym
output is returned as an NSC-by-NSymbols-by-NT array.
When this argument is set to "2-D"
, OFDM subcarriers and OFDM
symbols use one combined dimension in the representation of rxsym
and eqsym
.
The
rxsym
input must be an NRE-by-NR array.The
eqsym
output is returned as an NRE-by-NT array.
NSC represents the number of OFDM subcarriers. NSymbols represents the number of symbols. NRE represents the number of resource elements in an irregular subset of the OFDM subcarrier symbol grid. NT represents the number of transmit antennas. NR represents the number of receive antennas.
Output Arguments
eqsym
— Equalized symbols
3-D array | 2-D array
Equalized symbols, returned as a 3-D or 2-D array.
If
DataFormat
is set to"3-D"
, the function returns an NSC-by-NSymbols-by-NT array. NSC represents the number of OFDM subcarriers, NSymbols represents the number of OFDM symbols, and NT represents the number of transmit antennas.If
DataFormat
is set to"2-D"
, the function returns an NRE-by-NT array. NRE represents the number of resource elements in an irregular subset of the OFDM subcarrier symbol grid.
csi
— Soft channel state information
matrix
Soft channel state information, returned as a matrix with size(csi,1) =
size(hest,1)
and size(csi,2) =
NT = size(hest,2)
.
NT represents the number of transmit
antennas.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2022b
See Also
Functions
Objects
Blocks
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)