Main Content

casmmod

CASM modulation

Since R2024b

    Description

    [modsignal,efficiency] = casmmod(signal,pin,pquad) performs coherent adaptive sub-carrier modulation (CASM) on the input signal to return a multiplexed modulated signal, modsignal, and the power efficiency of the multiplexing process, efficiency. pin is the power for the in-phase (I) component of the multiplexed signal, and pquad is the power for the quadrature (Q) component of the multiplexed signal.

    CASM is a constant envelope modulation (CEM) scheme to combine multiple global navigation satellite system (GNSS) signals.

    example

    [modsignal,efficiency] = casmmod(signal,pin,pquad,modidx) also specifies the modulation indices for the signals when you specify more than two signals.

    example

    Examples

    collapse all

    Generate four random signals to modulate.

    numSignals = 4;
    signal = 1 - 2*randi([0 1],1000,numSignals);

    Set the power distribution between the in-phase and quadrature components to 40% and 60%, respectively.

    Set the modulation index for the third and fourth input signal components to pi/6 and pi/7, respectively.

    pin = 0.40;
    pquad = 0.60;
    modidx = [pi/6 pi/7];

    Perform CASM modulation.

    [modsignal,eff] = casmmod(signal,pin,pquad,modidx);

    Perform CASM modulation on these three Quasi-Zenith Satellite System (QZSS) signals:

    • L1 C/A

    • L1C data (L1CD)

    • L1C pilot (L1CP)

    Set the PRNID for the required satellite.

    PRNID = 193; 

    Set the number of C/A-code navigation data bits in the generated waveform.

    numNavDataBits = 1;
    % L1C requires twice the number of data bits of C/A-code for the same time duration
    L1CnumNavDataBits = 2*numNavDataBits;

    Initialize random data for each QZSS signal.

    randLNAVData = randi([0 1],1,numNavDataBits);
    randCNAV2Data = randi([0 1],1,L1CnumNavDataBits);

    Generate a C/A-code for the set PRNID.

    caCode = gnssCACode(PRNID,"QZSS");
    tempCABits = repmat(caCode,20,1);
    caBits = xor(tempCABits,randLNAVData);

    Rate match the C/A-code bits with the L1CP signal by repeating each bit 24 times.

    rateMatchedCABits = repelem(caBits(:),24);
    caCodeSig = 1 - 2*rateMatchedCABits(:);

    Generate L1C codes (data, pilot, and overlay) for the set PRNID.

    [l1cd,l1cp,l1co] = gpsL1CCodes(PRNID);

    Initialize the overlay code. Initialize the indices such that they circularly start from 1 after reading 1800 bits.

    overlayCodeIndices = mod((1:L1CnumNavDataBits) - 1,size(l1co,1)) + 1;
    overlayBits = l1co(overlayCodeIndices);

    Initialize the time-multiplexed binary offset carrier (TMBOC) indices.

    ut = [0; 4; 6; 29];
    vt = 0:309;
    boc61Indices = reshape(ut + 33*vt,[],1);      % Indices for BOC(6,1) modulation
    boc11Indices = setdiff(0:10229,boc61Indices); % Indices for BOC(1,1) modulation, excluding BOC(6,1) indices
    
    sps = 24;                                     % Samples per second
    numChipsPerBit = 10230;
    tmbocSig = zeros(numChipsPerBit*sps,L1CnumNavDataBits);
    oneBitSig = zeros(sps,numChipsPerBit);
    for ibit = 1:L1CnumNavDataBits
        l1cpo = xor(l1cp,overlayBits(ibit));
        oneBitSig(:,boc61Indices+1) = reshape(-1*bocmod(l1cpo(boc61Indices+1),6,1),sps,[]);
        oneBitSig(:,boc11Indices+1) = reshape(-1*bocmod(l1cpo(boc11Indices+1),1,1,6*2),sps,[]);
        tmbocSig(:,ibit) = oneBitSig(:);
    end
    
    l1cdBits = xor(l1cd,randCNAV2Data);
    l1cdSig = -1*bocmod(l1cdBits(:),1,1,6*2);

    Set the CASM signal in-phase power as 20% and the quadrature power as 80%.

    inphasePower = 0.20;
    quadraturePower = 0.80;
    m = pi/4;               % Modulation index for third signal component

    Perform CASM modulation.

    [QZSSL1BBWaveform,efficiency] = casmmod([caCodeSig,l1cdSig,tmbocSig(:)],inphasePower,quadraturePower,m); 

    Visualize the modulated waveform.

    % Set sample rate for plotting waveform
    fs = 24*1.023e6;
    % Visualize the QZSS Waveform
    bbscope = spectrumAnalyzer(SampleRate=fs, ...
        Title="Power spectrum of QZSS signals");
    bbscope(QZSSL1BBWaveform)

    Perform CASM modulation on these three Navigation with Indian Constellation (NavIC) signals to generate a complex baseband waveform.

    • Standard Positioning Service (SPS) signal

    • Restricted Service (RS) data signal

    • RS-pilot signal

    Set the PRNID for the satellite.

    PRNID = 1;

    Set the number of navigation data bits in the generated waveform.

    numNavDataBits = 3;

    NavIC uses course acquisition codes (C/A-codes) for spreading the navigation data spectrum at a chipping rate of 1.023 Mcps.

    numCAChipsPerDataBit = 1023*20;
    randNavICData = 1 - 2*randi([0 1],1,numNavDataBits);
    caCode = 1 - 2*double(gnssCACode(PRNID,"NavIC L5-SPS"));
    
    % Each navigation data bit corresponds to 20 repetitions of C/A-code
    caBits = repmat(caCode,20,1);
    SPSsig = caBits.*randNavICData; % Spread SPS data

    Generate random data bits for the RS-pilot and RS-data signals.

    dummyRSP = randi([0,1],numCAChipsPerDataBit*numNavDataBits,1); % RS pilot signal
    dummyRSD = randi([0,1],numCAChipsPerDataBit*numNavDataBits,1); % RS data signal

    Modulate the RS signals by using binary offset carrier (BOC) modulation. Rate-match the SPS signals with the BOC-modulated RS signals.

    RSPsig = bocmod(dummyRSP,5,2);
    RSDsig = bocmod(dummyRSD,5,2);
    RateMatchedSPSsig = repelem(SPSsig(:),10,1);

    Set the amplification factors for the RS-data, SPS, and RS-pilot signals, in that order.

    ampfactors  = [2/3 sqrt(2)/3 sqrt(2)/3];

    Derive the modulation index, in-phase power, and quadrature power.

    m = atan(ampfactors(3)/ampfactors(1)); % Modulation index
    inphasePower = ampfactors(2)/cos(m);
    quadraturePower = ampfactors(1)/cos(m);

    Perform CASM modulation of the SPS, RS-pilot, and RS-data signals.

    [NavICBBwaveform,efficiency] = casmmod([RSDsig,RateMatchedSPSsig,RSPsig],inphasePower^2,quadraturePower^2,m);

    Visualize the complex NavIC baseband waveform.

    fs = 10*1.023e6;                             % Sample rate
    bbscope = spectrumAnalyzer(SampleRate=fs, ...
    Title = "Power spectrum of NavIC signals");
    bbscope(NavICBBwaveform)

    Input Arguments

    collapse all

    Input signal, specified as a matrix with 5 or fewer columns.

    In the matrix, the number of rows represents the length of the input signal, and the number of columns represents the number of input signals to multiplex.

    Data Types: double
    Complex Number Support: Yes

    Power of the in-phase (I) component, specified as a real scalar.

    pin and pquad together define the power distribution between IQ components, which the function uses to generate the modsignal.

    Data Types: double

    Power of the quadrature (Q) component, specified as a real scalar.

    Data Types: double

    Modulation indices of the input signals, specified as one of these options.

    Note

    To specify modidx, you must specify more than two input signals.

    • Scalar — Assigns the same value to each input signal.

    • Vector — Assigns an individual value to each input signal. Because modulation indices are required when size(signal,2) is greater than 2, the length of this vector is in the range [1, 3].

    Data Types: double

    Output Arguments

    collapse all

    Multiplexed modulated signal, returned as a column vector of length size(signal,1). The modsignal argument is of the same data precision as the input signal.

    Data Types: double
    Complex Number Support: Yes

    Efficiency of modsignal, returned as a real scalar in the range [0, 1].

    The function computes efficiency as a ratio of total signal power to the total transmitted power.

    Data Types: double

    References

    [1] Dafesh, P. A., T. M. Nguyen, and S. Lazar. “Coherent Adaptive Subcarrier Modulation (CASM) for GPS Modernization,” 649–60, 1999.

    Extended Capabilities

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

    Version History

    Introduced in R2024b