Main Content

ofdmChannelResponse

Calculate OFDM channel response

Since R2023a

Description

hest = ofdmChannelResponse(pathgains,pathfilters,nfft,cplen) returns the frequency response of a time-varying channel for OFDM signals with FFT length equal to nfft and cyclic prefix length equal to cplen. The channel is specified by pathgains and pathfilters.

hest = ofdmChannelResponse(pathgains,pathfilters,nfft,cplen,activesc) returns the frequency response of the channel for OFDM subcarriers specified by the activesc vector.

example

hest = ofdmChannelResponse(pathgains,pathfilters,nfft,cplen,activesc,toffset) returns the frequency response of the channel for OFDM subcarriers specified by the activesc vector and the timing offset specified by toffset.

Examples

collapse all

This example estimates the channel response for an OFDM signal filtered through a 2-by-4 MIMO channel, and then uses the channel response to apply OFDM equalization to the received OFDM-demodulated signal.

Define simulation variables.

numTx = 2;       % Number of transmit antennas
numRx = 4;       % Number of receive antennas
bps = 6;         % Bits per QAM symbol (and OFDM data subcarrier)
M = 2^bps;       % Modulation order
nfft = 256;      % FFT length
cpLen = 16;      % Cyclic prefix length
numOFDMSym = 10; % Number of OFDM symbols
SNRdB = 40;      % Signal-to-noise ratio

Configure OFDM subcarriers.

ofdmNullIdx = ...   % Guard bands and DC subcarrier
    [1:9 (nfft/2+1) (nfft-8+1:nfft)]'; 
numDataSC = ...     % Number of data subcarriers
    nfft-length(ofdmNullIdx);

Generate an array of data symbols, QAM-modulate the symbols, and then OFDM-modulate the QAM-modulated symbols.

srcBits = randi([0,1],[numDataSC*bps numOFDMSym numTx]);
qamTx = qammod(srcBits,M, ...
    InputType="bit", ...
    UnitAveragePower=true);
ofdmTx = ofdmmod(qamTx,nfft,cpLen,ofdmNullIdx);

Filter the OFDM-modulated signal through a MIMO channel and AWGN.

mimoChannel = comm.MIMOChannel( ...
    SampleRate=1e6, ...
    PathDelays=[1.5e-6 3e-6 5e-6], ...
    AveragePathGains=[1.2 0.5 0.2], ...
    MaximumDopplerShift=1, ...
    SpatialCorrelationSpecification="None", ...
    NumTransmitAntennas=numTx, ...
    NumReceiveAntennas=numRx, ...
    PathGainsOutputPort=true);
[channelOut,pathGains] = mimoChannel(ofdmTx);
ofdmRx = awgn(channelOut,SNRdB,"measured");

Use channel path gains returned by the MIMO channel object, and the path filters and timing offset returned by the info object function, to estimate the OFDM channel response.

mimoChannelInfo = info(mimoChannel);
pathFilters = mimoChannelInfo.ChannelFilterCoefficients;
toffset = mimoChannelInfo.ChannelFilterDelay;
hest = ofdmChannelResponse(pathGains,pathFilters,nfft,cpLen, ...
    setdiff(1:nfft,ofdmNullIdx),toffset);

To use the OFDM channel response when equalizing the OFDM-demodulated signal, you must reshape the NSC-by-NOFDMsym-by-NT-by-NR array to an NQAMsym-by-NT-by-NR array. Before demodulating the OFDM signal, account for the timing offset and symbol offset, remove the initial samples, and then pad with zeros to keep the signal length unchanged.

OFDM-demodulate and equalize the received signal. Show the received OFDM-demodulated symbols (rxSym) and the equalized OFDM-demodulated symbols (eqSym). The constellation of the OFDM-demodulated symbols before equalization does not resemble the QAM constellation. After equalization, the constellation points overlay the reference constellation.

hestRx = reshape(hest,[],numTx,numRx);
zeropadding = zeros(toffset,numRx);
ofdmDemodIn = [ofdmRx(toffset+1:end,:); zeropadding];
symOffset = cpLen/2;
rxSym = ofdmdemod(ofdmDemodIn,nfft,cpLen,cpLen,ofdmNullIdx);
eqSym = ofdmEqualize(rxSym,hestRx,Algorithm="zf");
refconst = qammod(0:M-1,M,UnitAveragePower=true);
constellationDiagram = comm.ConstellationDiagram( ...
    NumInputPorts=2, ...
    XLimits=[-2 2], ...
    YLimits=[-2 2], ...
    ReferenceConstellation=refconst, ...
    ChannelNames={"rxSym","eqSym"});
constellationDiagram(rxSym(:),eqSym(:));

Input Arguments

collapse all

Channel path gains, specified as an NS-by-NP-by-T-by-NR array.

  • NS is the number of samples.

  • NP is the number of paths.

  • NT is the number of transmit antennas.

  • NR is the number of receive antennas.

The channel path gains follow the definition of channel path gains as calculated and output by the fading channel System objects. For example, see comm.MIMOChannel, comm.RayleighChannel, comm.RicianChannel, or comm.ChannelFilter.

Data Types: double | single
Complex Number Support: Yes

Channel path filter coefficients, specified as an NP-by-NH matrix.

  • NP is the number of paths.

  • NH is the number of impulse response samples.

The coefficient matrix is used to convert path gains to channel filter tap gains for each sample and each pair of transmit and receive antennas. The channel path filter coefficients follow the definition of channel path filter coefficients as calculated by the info object function of the fading channel System objects.

Data Types: double | single

FFT length, specified as a positive, integer scalar. The FFT length must align with that of the OFDM-modulated signal.

Data Types: double | single

Cyclic prefix length of one OFDM symbol, specified as a nonnegative, integer scalar with a value less than nfft.

Data Types: double | single

Number of active subcarriers, specified as a positive, integer scalar or column vector of values in the range [1, nfft].

Data Types: double | single

Timing offset in samples, specified as a nonnegative, integer scalar.

Data Types: double | single

Output Arguments

collapse all

Frequency response, returned as an NSC-by-NSym-by-NT-by-NR array.

  • NSC is the number of OFDM subcarriers and is equal to the:

  • NSym is the number of OFDM symbols.

  • NT is the number of transmit antennas.

  • NR is the number of receive antennas.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2023a