Main Content

pnkcode

Generate polyphase P(n,k) code

Since R2024a

    Description

    C = pnkcode(N,n,k) generates a polyphase P(n,k) code sequence C of length-N. The sequence is derived by sampling the phase function of a nonlinear frequency modulated waveform (NLFM). The inputs n and k determine the shape of the power spectrum of the sequence.

    W(f)=k+(1+k)cos(πfB)n,|f|B/2W(f)=0,|f|B/2

    where k is defined by the argument k and n is defined by the argument n. Autocorrelation function sidelobe levels also depend on n and k.

    example

    Examples

    collapse all

    Create a 100-sample phase-coded modulated waveform using the phased.PhaseCodedWaveform System object™. Use the 'Custom' property to create a waveform from a P(n,k) code with parameters set to n = 4 and k = 0.015. The chip width (tau) is 1e-6 s and the pulse repetition frequency (prf) is 1 kHz. Plot the ambiguity function.

    N = 100;

    Set the P(n, k) design parameters.

    n = 4;
    k = 0.015;

    Generate the P(n,k) code.

    pnk = pnkcode(N,n,k);
    tau = 1e-6;
    prf = 1e3;

    Set the sampling frequency to 10 times the chip width.

    fs = 10/tau;

    Create a custom phase coded waveform System object™ and generate the waveform signal.

    waveform = phased.PhaseCodedWaveform('SampleRate',fs, ...
        Code="Custom",CustomCode=pnk,ChipWidth=tau,PRF=prf);
    sig = waveform();

    Compute and plot the ambiguity function.

    [af,delay] = ambgfun(sig,fs,prf,Cut="Doppler");
    plot(delay/tau,mag2db(abs(af)))
    xlabel('Delay (t/tau)')
    ylabel('(dB)')
    title('Ambiguity Function')
    xlim([-N N])
    ylim([-60 1])
    grid on

    Figure contains an axes object. The axes object with title Ambiguity Function, xlabel Delay (t/tau), ylabel (dB) contains an object of type line.

    Input Arguments

    collapse all

    Code sequence length, specified as a positive integer.

    Example: 76

    Data Types: double

    Exponent parameter of power spectrum shape, specified as a positive scalar.

    Example: 0.1

    Data Types: double

    Amplitude parameter of power spectrum shape, specified as a positive scalar.

    Example: 2

    Data Types: double

    Output Arguments

    collapse all

    Code sequence, returned as a length-N complex-valued vector.

    Data Types: double
    Complex Number Support: Yes

    References

    [1] Levanon, N. and E. Mozeson. Radar Signals. Hoboken, NJ: John Wiley & Sons, 2004.

    [2] Haderer, Heinz, Reinhard Feger, and Andreas Stelzer. "A comparison of phase-coded CW radar modulation schemes for integrated radar sensors." In 2014 44th European Microwave Conference, pp. 1896-1899. IEEE, 2014.

    Extended Capabilities

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

    Version History

    Introduced in R2024a