Main Content


Perform IQ sampling on CTE field of Bluetooth LE packet

Since R2022a


    iqSamples = bleCTEIQSample(cteSamples) returns in-phase and quadrature (IQ) samples, iqSamples, by performing IQ sampling at each microsecond of the reference period and each sample slot of the constant tone extension (CTE), cteSamples.


    iqSamples = bleCTEIQSample(cteSamples,Name=Value) specifies one or more optional name-value arguments. For example, Mode="LE2M" sets the Bluetooth® low energy (LE) physical layer (PHY) reception mode to 2 Mbps.


    collapse all

    Specify a connection-oriented protocol data unit (PDU) for the angle of departure (AoD) CTE. Set the slot duration and CTE time of the PDU to 2 microseconds and 16 microseconds, respectively.

    pduHex = '1B820127';                      % In hexadecimal
    pdu = int2bit(hex2dec(pduHex),32,false);  % In binary

    Create a cyclic redundancy check (CRC) generator.

    crcGen = comm.CRCGenerator('z^24+z^10+z^9+z^6+z^4+z^3+z+1', ...
        InitialConditions=int2bit(hex2dec('555551'),24), ...

    Append the CRC to the PDU.

    pduCRC = crcGen(pdu);

    Specify the samples per symbol and signal-to-noise ratio (SNR).

    sps = 16;   
    snr = 30;   % In dB

    Generate the Bluetooth LE transmit waveform.

    txWaveform = bleWaveformGenerator(pduCRC,ChannelIndex=36,...

    Pass the generated Bluetooth LE waveform through the additive white Gaussian noise (AWGN) channel.

    rxWaveform = awgn(txWaveform,snr);

    Segregate the noisy Bluetooth LE waveform corresponding to the CTE.

    cteSamples = rxWaveform(end-16*sps+1:end);

    Specify the slot duration and sample offset for IQ sampling. This example performs IQ sampling for a slot duration of 2 microseconds and takes the 8th sample after the occurrence of an antenna switch.

    slotDuration = 2;   % In microseconds
    sampleOffset = 8;

    Perform IQ sampling on the Bluetooth LE waveform corresponding to the CTE.

    iqSamples = bleCTEIQSample(cteSamples,SamplesPerSymbol=sps, ...
    iqSamples = 9×1 complex
      -0.6911 - 0.5712i
       0.5821 - 0.7026i
       0.6972 + 0.5727i
      -0.5762 + 0.7086i
      -0.7082 - 0.5779i
       0.5747 - 0.7059i
       0.6986 + 0.5743i
      -0.5805 + 0.7023i
      -0.5580 + 0.6974i

    Input Arguments

    collapse all

    Number of CTE samples received, specified as a complex-valued column vector representing a time-domain signal. The vector size must be Ns-by-1, where Ns is the number of CTE samples. This table shows how the Mode and SamplesPerSymbol (sps) name-value arguments impact the value of Ns.

    Mode ValueNs ValueMultiple of SamplesPerSymbol
    LE1M[16×sps, 160×sps]8×sps
    LE2M[32×sps, 320×sps]16×sps

    Data Types: double
    Complex Number Support: Yes

    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: Mode='LE2M' sets the Bluetooth LE PHY reception mode to 2 Mbps.

    PHY reception mode, specified as 'LE1M' or 'LE2M'.

    Data Types: char | string

    Samples per symbol, specified as a positive integer.

    Data Types: double

    Switch and sample slot duration, specified as 1 or 2. Units are in microseconds.

    Data Types: double

    Sample offset, specified as a positive integer in a range that is dependent on the Mode name-value argument.

    Mode ValueSampleOffset Value Range
    'LE1M'[(sps/8), 7×(sps/8)]
    'LE2M'[(sps/4), 7×(sps/4)]

    Data Types: double

    Output Arguments

    collapse all

    IQ samples, returned as a complex-valued column vector. This output corresponds to the 8 microseconds value of the reference period and SlotDuration.

    Data Types: double


    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 22, 2021.

    [2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3.

    Extended Capabilities

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

    Version History

    Introduced in R2022a