ofdmChannelResponse
Syntax
Description
returns the frequency response of a time-varying channel for OFDM signals with FFT length
equal to hest = ofdmChannelResponse(pathgains,pathfilters,nfft,cplen)nfft and cyclic prefix length equal to
cplen. The channel is specified by pathgains and
pathfilters. For more information, see OFDM Channel Response.
Examples
Obtain the channel response for a beamformed OFDM signal with parallel data streams filtered through an -by- MIMO channel. Use the channel response to apply OFDM equalization to the received OFDM-demodulated signal.
Define simulation variables.
rng(1); numStreams = 2; % Number of parallel data streams (Ns) numTx = 4; % Number of transmit antennas (Nt) numRx = 3; % Number of receive antennas (Nr) bps = 6; % Bits per QAM symbol (and OFDM data subcarrier) nfft = 256; % FFT length cpLen = 16; % Cyclic prefix length numOFDMSym = 10; % Number of OFDM symbols SNRdB = 40; % Signal-to-noise ratio
Check that the number of data streams is no greater than either the number of transmit antennas or the number of receive antennas.
if numStreams > min(numTx,numRx) error('numStreams must be equal to or less than numTx and numRx.'); end
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 consisting of parallel data streams, QAM-modulate the symbols, and then OFDM-modulate the QAM-modulated symbols.
dataBits = randi([0,1],[numDataSC*bps numOFDMSym numStreams]); M = 2^bps; % Modulation order qamTx = qammod(dataBits,M, ... InputType="bit", ... UnitAveragePower=true); ofdmOut = ofdmmod(qamTx,nfft,cpLen,ofdmNullIdx);
Beamforming expands the dimensionality of the transmit signal to improve link performance over multipath channels. The data streams are fed through a beamformer that focuses the transmit energy over an -by-1 transmit antenna array where the number of antennas .

Form a beamformer matrix from steering vectors acting on each stream.
% Beamform the transmitted signal fc = 1e9; lambda = physconst('LightSpeed')/fc; beamAngles = 15; antIdx = (0:numTx-1); antDelay = 2*pi*sin(2*pi*beamAngles*(0:numStreams-1).'/360)/lambda; B = exp(1i*antIdx.*antDelay); % Ns x Nt beamformer matrix txOut = ofdmOut * B;
Filter the OFDM-modulated signal through a MIMO channel to get the channel coefficients.
mimoChannel = comm.MIMOChannel( ... SampleRate=1e6, ... PathDelays=[0 3e-6 5e-6], ... AveragePathGains=[0 0.5 0.2], ... MaximumDopplerShift=0, ... SpatialCorrelationSpecification="None", ... NumTransmitAntennas=numTx, ... NumReceiveAntennas=numRx, ... PathGainsOutputPort=true); [channelOut,pathGains] = mimoChannel(txOut);
In a practical system, the channel must be sounded to estimate the channel response. Instead of sounding, the ofdmChannelResponse function computes the exact channel response using the path gains and path filters that are available after you pass data through the MIMO channel System object. Use channel path gains returned by the MIMO channel object, and the path filters and timing offset returned by the info object function, to obtain the OFDM channel response. If , the channel forms an over-determined system (there are more receive antennas than necessary to adequately decode the transmitted signals). Call ofdmChannelResponse with the pathGains from the MIMO channel function to get the channel response.
mimoChannelInfo = info(mimoChannel); pathFilters = mimoChannelInfo.ChannelFilterCoefficients; toffset = mimoChannelInfo.ChannelFilterDelay; h = ofdmChannelResponse(pathGains,pathFilters,nfft,cpLen, ... setdiff(1:nfft,ofdmNullIdx),toffset); % Nsc x Nsym x Nt x Nr [rxIn,nVar] = awgn(channelOut,SNRdB,"measured");
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.
zeropadding = zeros(toffset,numRx); ofdmDemodIn = [rxIn(toffset+1:end,:); zeropadding]; symOffset = cpLen/2;
OFDM-demodulate and equalize the received signal.
rxSym = ofdmdemod(ofdmDemodIn,nfft,cpLen,symOffset,ofdmNullIdx);
The effects of beamforming and the MIMO channel affect the received data streams. The effective channel () is an -by- matrix defined as the product of the transmit beamformer and the MIMO channel coefficients.

To use the OFDM channel response when equalizing the OFDM-demodulated signal, you must reshape the -by--by--by- array to an -by--by- array. Form the effective channel using the beamformer matrix B and the reshaped channel coefficients h. Equalize the received OFDM signal using the calculated effective channel, the noise variance, and the MMSE algorithm.
hReshaped = reshape(h,[],numTx,numRx); hEff = zeros(numDataSC*numOFDMSym,numStreams,numRx); for k = 1:numOFDMSym*numDataSC hEff(k,:,:) = B * squeeze(hReshaped(k,:,:)); end eqSym = ofdmEqualize(rxSym,hEff,nVar);
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 lay near the reference constellation.
figure(1); scatterplot(rxSym(:));

figure(2); scatterplot(eqSym(:));

Input Arguments
Channel path gains, specified as an
NS-by-NP-by-NT-by-NR
numeric array, or a dlarray (Deep Learning Toolbox)
object. For more information, see Array Support.
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. This function assumes that the path gains sample rate
matches the OFDM sample rate.
Data Types: double | single
Complex Number Support: Yes
Channel path filter coefficients, specified as an NP-by-NH numeric 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. For more information, see OFDM Channel Response.
Data Types: double | single
Output Arguments
Frequency response, returned as an
NSC-by-NSymbols-by-NT-by-NR
numeric array, or a dlarray (Deep Learning Toolbox)
object. If the input signal, pathgains, is
a dlarray, then this output, hest, is also a
dlarray.For more information, see Array Support.
NSC is the number of OFDM subcarriers and is equal to the:
NSymbols is the number of whole OFDM symbols contained in
pathgains. Specifically, floor(NS/(NFFT + LCP)).NT is the number of transmit antennas.
NR is the number of receive antennas.
More About
The ofdmChannelResponse function supports input signals represented in a
numeric array, dlarray (Deep Learning Toolbox), or
gpuArray (Parallel Computing Toolbox).
The number of batch observations (NB) is an optional dimension that can be added to this input for all supported data types.
pathgains— The channel path gains can be an array of up to five dimensions, specified as an NS-by-NP-by-NT-by-NR-by-NB array.
NS is the number of samples, NP is the number of paths, NT is the number of transmit antennas,and NR is the number of receive antennas.
For a list of Communications Toolbox™ features that support dlarray objects, see AI for Wireless.
Algorithms
The OFDM channel response algorithm uses an FFT to compute the channel estimates by using the path gains and path filter coefficients available after you pass data through a MIMO channel. 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.
This figure shows one OFDM symbol in addition to the input channel impulse and the output channel impulse response. The algorithm ignores samples outside the OFDM symbol.

For a time-varying channel, such as most fading channels, the impulse response depends on the location of the impulse at the channel input.
Extended Capabilities
Usage notes and limitations:
If dynamic memory allocation is off,
nfftandcplenmust be compilation time constants. To enforce a static value, assignnfftandcplenby usingcoder.const(MATLAB Coder).
This function supports GPU array inputs. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2023aThe ofdmChannelResponse function adds support for C code generation with
input signals stored as dlarray (Deep Learning Toolbox)
objects.
The ofdmChannelResponse function adds support for dlarray (Deep Learning Toolbox) object
processing for deep learning applications.
The ofdmChannelResponse function adds support for gpuArray (Parallel Computing Toolbox) object processing to run code on a graphics processing unit
(GPU).
See Also
Functions
Objects
Blocks
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)