Main Content

Create a library of pulse compression specifications

The `phased.PulseCompressionLibrary`

System object™ creates a pulse compression library.
The library contains sets of parameters that describe pulse compression operations performed
on received signals to generate their range response. You can use this library to perform
matched filtering or stretch processing. This object can process waveforms created by the
`phased.PulseWaveformLibrary`

object.

To make a pulse compression library

Create the

`phased.PulseCompressionLibrary`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?.

System object creates a pulse compression library,
`complib`

= phased.PulseCompressionLibrary()`complib`

, with default property values.

creates a pulse compression library with each property `complib`

= phased.PulseCompressionLibrary(`Name`

,`Value`

)`Name`

set to a
specified `Value`

. You can specify additional name-value pair arguments
in any order as
(`Name1`

,`Value1`

,...,`NameN`

,`ValueN`

).
Enclose each property name in single quotes.

```
complib =
phased.PulseCompressionLibrary('SampleRate',1e9,'WaveformSpecification',{{'Rectangular','PRF',1e4,'PulseWidth',100e-6},{'SteppedFM','PRF',1e4}},'ProcessingSpecification',{{'MatchedFilter','SpectrumWindow','Hann'},{'MatchedFilter','SpectrumWindow','Taylor'}})
```

creates a library with two matched filters. One is matched to a rectangular waveform and
the other to a stepped FM waveform. The matched filters use a Hann window and a Taylor
window, respectively.Unless otherwise indicated, properties are *nontunable*, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
`release`

function unlocks them.

If a property is *tunable*, you can change its value at
any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

`SampleRate`

— Waveform sample rate`1e6`

(default) | positive scalarWaveform sample rate, specified as a positive scalar. All waveforms have the same sample rate. Units are in hertz.

**Example: **
`100e3`

**Data Types: **`double`

`PropagationSpeed`

— Signal propagation speed`physconst('LightSpeed')`

(default) | positive scalarSignal propagation speed, specified as a positive scalar. Units are in meters per second. The
default propagation speed is the value returned by
`physconst('LightSpeed')`

. See `physconst`

for more information.

**Example: **`3e8`

**Data Types: **`double`

`WaveformSpecification`

— Pulse waveforms`{{'Rectangular','PRF',10e3,'PulseWidth',100e-6},{'LinearFM','PRF',1e4,'PulseWidth',50e-6,'SweepBandwidth',1e5,'SweepDirection','Up','SweepInterval','Positive'}}`

(default) | cell arrayPulse waveforms, specified as a cell array. Each cell of the array contains the specification of one waveform.

{{Waveform 1 Specification},{Waveform 2 Specification},{Waveform 3 Specification}, ...}

{PulseIdentifier,Name1,Value1,Name2,Value2, ...}

This System object supports four built-in waveforms and also lets you specify custom waveforms. For the built-in waveforms, the waveform specifier consists of a waveform identifier followed by several name-value pairs setting the properties of the waveform. For the custom waveforms, the waveform specifier consists of a handle to a user-define waveform function and the functions input arguments.

**Waveform Types**

Pulse Type | Pulse Identifier | Waveform Arguments |

Linear FM | `'LinearFM'` | Linear FM Waveform Arguments |

Phase coded | `'PhaseCoded'` | Phase-Coded Waveform Arguments |

Rectangular | `'Rectangular'` | Rectangular Waveform Arguments |

Stepped FM | `'SteppedFM'` | Stepped FM Waveform Arguments |

Custom | Function handle | Custom Waveform Arguments |

**Example: **`{{'Rectangular','PRF',10e3,'PulseWidth',100e-6},{'Rectangular','PRF',100e3,'PulseWidth',20e-6}}`

**Data Types: **`cell`

`ProcessingSpecification`

— Pulse compression descriptions`{{'MatchedFilter','SpectrumWindow','None'},{'StretchProcessor','RangeSpan',200,'ReferenceRange',5e3,'RangeWindow','None'}}`

(default) | cell arrayPulse compression descriptions, specified as a cell array of processing specifications. Each cell defines a different processing specification. Each processing specification is itself a cell array containing the processing type and processing arguments.

{{Processing 1 Specification},{Processing 2 Specification},{Processing 3 Specification}, ...}

{ProcessType,Name,Value,...}

`ProcessType`

is either `'MatchedFilter'`

or `'StretchProcessor'`

.
`'MatchedFilter'`

– The name-value pair arguments are`'Coefficients'`

,`coeff`

– specifies the matched filter coefficients,`coeff`

, as a column vector. When not specified, the coefficients are calculated from the`WaveformSpecification`

property. For the Stepped FM waveform containing multiple pulses,`coeff`

corresponds to each pulse until the pulse index,`idx`

changes.`'SpectrumWindow'`

,`sw`

– specifies the spectrum weighting window,`sw`

, applied to the waveform. Window values are one of`'None'`

,`'Hamming'`

,`'Chebyshev'`

,`'Hann'`

,`'Kaiser'`

, and`'Taylor'`

. The default value is`'None'`

.`'SidelobeAttenuation'`

,`slb`

– specifies the sidelobe attenuation window,`slb`

, of the Chebyshev or Taylor window as a positive scalar. The default value is 30. This parameter applies when you set`'SpectrumWindow'`

to`'Chebyshev'`

or`'Taylor'`

.`'Beta'`

,`beta`

– specifies the parameter,`beta`

, that determines the Kaiser window sidelobe attenuation as a nonnegative scalar. The default value is 0.5. This parameter applies when you set`'SpectrumWindow'`

to`'Kaiser'`

.`'Nbar'`

,`nbar`

– specifies the number of nearly constant level sidelobes,`nbar`

, next to the main lobe in a Taylor window as a positive integer. The default value is 4. This parameter applies when you set`'SpectrumWindow'`

to`'Taylor'`

.`'SpectrumRange'`

,`sr`

– specifies the spectrum region,`sr`

, on which the spectrum window is applied as a 1-by-2 vector having the form`[StartFrequency EndFrequency]`

. The default value is [0 1.0e5]. This parameter applies when you set the`'SpectrumWindow'`

to any value other than 'None'. Units are in Hz.Both

`StartFrequency`

and`EndFrequency`

are measured in the baseband region [-*Fs*/2*Fs*/2].*Fs*is the sample rate specified by the`SampleRate`

property.`StartFrequency`

cannot be larger than`EndFrequency`

.

`'StretchProcessor'`

– The name-value pair arguments are`'ReferenceRange'`

,`refrng`

– specifies the center of the ranges of interest,`refrng`

, as a positive scalar. The`refrng`

must be within the unambiguous range of one pulse. The default value is 5000. Units are in meters.`'RangeSpan'`

,`rngspan`

– specifies the span of the ranges of interest.`rngspan`

, as a positive scalar. The range span is centered at the range value specified in the`'ReferenceRange'`

parameter. The default value is 500. Units are in meters.`'RangeFFTLength'`

,`len`

– specifies the FFT length in the range domain,`len`

, as a positive integer. If not specified, the default value is same as the input data length.`'RangeWindow'`

,`rw`

specifies the window used for range processing,`rw`

, as one of`'None'`

,`'Hamming'`

,`'Chebyshev'`

,`'Hann'`

,`'Kaiser'`

, and`'Taylor'`

. The default value is`'None'`

.

**Example: **`'StretchProcessor'`

**Data Types: **`string`

| `struct`

Specify optional
comma-separated pairs of `Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

```
{'LinearFM','PRF',1e4,'PulseWidth',50e-6,'SweepBandwidth',1e5,...
'SweepDirection','Up','SweepInterval','Positive'}
```

`PRF`

— Pulse repetition frequency`1e4`

(default) | positive scalarPulse repetition frequency (PRF), specified as a positive scalar. Units are in hertz. See Pulse Repetition Frequency Restrictions for restrictions on the PRF.

**Example: **`20e3`

**Data Types: **`double`

`PulseWidth`

— Pulse duration`5e-5`

(default) | positive scalarPulse duration, specified as a positive scalar. Units are in seconds. You cannot
specify both `PulseWidth`

and `DutyCycle`

.

**Example: **`100e-6`

**Data Types: **`double`

`DutyCycle`

— Pulse duty cycle`0.5`

| positive scalarPulse duty cycle, specified as a positive scalar greater than zero and less than
or equal to one. You cannot specify both `PulseWidth`

and
`DutyCycle`

.

**Example: **`0.7`

**Data Types: **`double`

`SweepBandwidth`

— Bandwidth of the FM sweep`1e5`

(default) | positive scalarBandwidth of the FM sweep, specified as a positive scalar. Units are in hertz.

**Example: **`100e3`

**Data Types: **`double`

`SweepDirection`

— Bandwidth of the FM sweep`'Up'`

(default) | `'Down'`

Direction of the FM sweep, specified as `'Up'`

or
`'Down'`

. `'Up'`

corresponds to increasing
frequency. `'Down'`

corresponds to decreasing frequency.

**Data Types: **`char`

`SweepInterval`

— FM sweep interval`'Positive'`

(default) | `'Symmetric'`

FM sweep interval, specified as `'Positive'`

or
`'Symmetric'`

. If you set this property value to
`'Positive'`

, the waveform sweeps the interval between 0 and
*B*, where *B* is the
`SweepBandwidth`

argument value. If you set this property value
to `'Symmetric'`

, the waveform sweeps the interval between
–*B*/2 and *B*/2.

**Example: **`'Symmetric'`

**Data Types: **`char`

`Envelope`

— Envelope function`'Rectangular'`

(default) | `'Gaussian'`

Envelope function, specified as `'Rectangular'`

or
`'Gaussian'`

.

**Example: **`'Gaussian'`

**Data Types: **`char`

`FrequencyOffset`

— Frequency offset of pulse`0`

(default) | scalarFrequency offset of pulse, specified as a scalar. The frequency offset shifts the frequency of the generated pulse waveform. Units are in hertz.

**Example: **`100e3`

**Data Types: **`double`

Specify optional
comma-separated pairs of `Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

```
{'PhaseCoded','PRF',1e4,'Code','Zadoff-Chu',
'SequenceIndex',3,'ChipWidth',5e-6,'NumChips',8}
```

`PRF`

— Pulse repetition frequency`1e4`

(default) | positive scalarPulse repetition frequency (PRF), specified as a positive scalar. Units are in hertz. See Pulse Repetition Frequency Restrictions for restrictions on the PRF.

**Example: **`20e3`

**Data Types: **`double`

`Code`

— Type of phase modulation code`'Frank'`

(default) | `'P1'`

| `'P2'`

`'Px'`

| `'Zadoff-Chu'`

| `'P3'`

| `'P4'`

| `'Barker'`

Type of phase modulation code, specified as `'Frank'`

,
`'P1'`

, `'P2'`

, `'Px'`

,
`'Zadoff-Chu'`

, `'P3'`

, `'P4'`

,
or `'Barker'`

.

**Example: **`'P1'`

**Data Types: **`char`

`SequenceIndex`

— `Zadoff-Chu`

sequence index`1`

(default) | positive integerSequence index used for the `Zadoff-Chu`

code, specified as a
positive integer. The value of `SequenceIndex`

must be relatively
prime to the value of `NumChips`

.

**Example: **`3`

To enable this name-value pair, set the `Code`

property to
`'Zadoff-Chu'`

.

**Data Types: **`double`

`ChipWidth`

— Chip duration`1e-5`

(default) | positive scalarChip duration, specified as a positive scalar. Units are in seconds. See Chip Restrictions for restrictions on chip sizes.

**Example: **`30e-3`

**Data Types: **`double`

`NumChips`

— Number of chips in waveform`4`

(default) | positive integerNumber of chips in waveform, specified as a positive integer. See Chip Restrictions for restrictions on chip sizes.

**Example: **`3`

**Data Types: **`double`

`FrequencyOffset`

— Frequency offset of pulse`0`

(default) | scalarFrequency offset of pulse, specified as a scalar. The frequency offset shifts the frequency of the generated pulse waveform. Units are in hertz.

**Example: **`100e3`

**Data Types: **`double`

Specify optional
comma-separated pairs of `Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

`{'Rectangular','PRF',10e3,'PulseWidth',100e-6}`

`PRF`

— Pulse repetition frequency`1e4`

(default) | positive scalarPulse repetition frequency (PRF), specified as a positive scalar. Units are in hertz. See Pulse Repetition Frequency Restrictions for restrictions on the PRF.

**Example: **`20e3`

**Data Types: **`double`

`PulseWidth`

— Pulse duration`5e-5`

(default) | positive scalarPulse duration, specified as a positive scalar. Units are in seconds. You cannot
specify both `PulseWidth`

and `DutyCycle`

.

**Example: **`100e-6`

**Data Types: **`double`

`DutyCycle`

— Pulse duty cycle`0.5`

| positive scalarPulse duty cycle, specified as a positive scalar greater than zero and less than
or equal to one. You cannot specify both `PulseWidth`

and
`DutyCycle`

.

**Example: **`0.7`

**Data Types: **`double`

`FrequencyOffset`

— Frequency offset of pulse`0`

(default) | scalarFrequency offset of pulse, specified as a scalar. The frequency offset shifts the frequency of the generated pulse waveform. Units are in hertz.

**Example: **`100e3`

**Data Types: **`double`

`Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

`{'SteppedFM','PRF',10e-4}`

`PRF`

— Pulse repetition frequency`1e4`

(default) | positive scalar**Example: **`20e3`

**Data Types: **`double`

`PulseWidth`

— Pulse duration`5e-5`

(default) | positive scalarPulse duration, specified as a positive scalar. Units are in seconds. You cannot
specify both `PulseWidth`

and `DutyCycle`

.

**Example: **`100e-6`

**Data Types: **`double`

`DutyCycle`

— Pulse duty cycle`0.5`

| positive scalarPulse duty cycle, specified as a positive scalar greater than zero and less than
or equal to one. You cannot specify both `PulseWidth`

and
`DutyCycle`

.

**Example: **`0.7`

**Data Types: **`double`

`NumSteps`

— Number of frequency steps in waveform`5`

(default) | positive integerNumber of frequency steps in waveform, specified as a positive integer.

**Example: **`3`

**Data Types: **`double`

`FrequencyStep`

— Linear frequency step size`20e3`

(default) | positive scalarLinear frequency step size, specified as a positive scalar.

**Example: **`100.0`

**Data Types: **`double`

`FrequencyOffset`

— Frequency offset of pulse`0`

(default) | scalar**Example: **`100e3`

**Data Types: **`double`

You can create a custom waveform from a user-defined function. The first input argument of the function must be the sample rate. For example, specify a hyperbolic waveform function,

function wav = HyperbolicFM(fs,prf,pw,freq,bw,fcent),

`fs`

is the sample rate and `prf`

,
`pw`

, `freq`

, `bw`

, and
`fcent`

are other waveform arguments. The function must have at least one
output argument, `wav`

, to return the samples of each pulse. This output
must be a column vector. There can be other outputs returned following the waveform
samples.Then, create a waveform specification using a function handle instead of the waveform identifier. The first cell in the waveform specification must be a function handle. The remaining cells contain all function input arguments except the sample rate. Specify all input arguments in the order they are passed into the function.

waveformspec = {@HyperbolicFM,prf,pw,freq,bw,fcent}

`X`

— Input signalcomplex-valued

Input signal, specified as a complex-valued
*K*-by-*L* matrix, complex-valued
*K*-by-*N* matrix, or a complex-valued
*K*-by-*N*-by-*L* array.
*K* denotes the number of fast time samples, *L*
the number of pulses, and *N* is the number of channels. Channels can
be array elements or beams.

**Data Types: **`double`

**Complex Number Support: **Yes

`idx`

— Index of processing specification in pulse compression librarypositive integer

Index of the processing specification in the pulse compression library, specified as a positive integer.

**Data Types: **`double`

`Y`

— Output signalcomplex-valued

Output signal, returned as a complex-valued
*M*-by-*L* matrix, complex-valued
*M*-by-*N* matrix, or a complex-valued
*M*-by-*N*-by-*L* array.
*M* denotes the number of fast time samples, *L*
the number of pulses, and *N* is the number of channels. Channels can
be array elements or beams. The number of dimensions of `Y`

matches
the number of dimensions of `X`

.

When matched filtering is performed, *M* is equal to the number
of rows in `X`

. When stretch processing is performed and you
specify a value for the `RangeFFTLength`

name-value pair,
*M* is set to the value of `RangeFFTLength`

. When
you do not specify `RangeFFTLength`

, *M* is equal to
the number of rows in `X`

.

**Data Types: **`double`

**Complex Number Support: **Yes

`rng`

— Sample rangereal-valued length-

Sample ranges, returned as a real-valued length-*M* vector where
*M* is the number of rows of `Y`

. Elements of
this vector denote the ranges corresponding to the rows of `Y`

.

**Data Types: **`double`

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

`plotResponse` | Plot range response from pulse compression library |

Create a rectangular waveform and a linear FM waveform. Use the processing methods in the pulse compression library to range-process the waveforms. Use matched filtering for the rectangular waveform and stretch processing for the linear FM waveform.

Create two waveforms using the `phased.PulseWaveformLibrary`

System object. The sampling frequency is 1 MHz and the pulse repetition frequency for both waveforms is 1 kHz . The pulse width is also the same at 50 microsec.

fs = 1.0e6; prf = 1e3; pw = 50e-6; waveform1 = {'Rectangular','PRF',prf,'PulseWidth',pw}; waveform2 = {'LinearFM','PRF',prf,'PulseWidth',pw,... 'SweepBandwidth',1e5,'SweepDirection','Up',... 'SweepInterval', 'Positive'}; pulselib = phased.PulseWaveformLibrary('WaveformSpecification',... {waveform1,waveform2},'SampleRate',fs);

Retrieve the waveforms for processing by the pulse compression library.

rectwav = pulselib(1); lfmwav = pulselib(2);

Create the compression processing library using the `phased.PulseCompressionLibrary`

System object with two processing specifications. The first processing specification is matched filtering and the second is stretch processing.

mf = getMatchedFilter(pulselib,1); procspec1 = {'MatchedFilter','Coefficients',mf}; procspec2 = {'StretchProcessor','ReferenceRange',5000,... 'RangeSpan',200,'RangeWindow','Hamming'}; comprlib = phased.PulseCompressionLibrary( ..., 'WaveformSpecification',{waveform1,waveform2}, ... 'ProcessingSpecification',{procspec1,procspec2}, ... 'SampleRate',fs,'PropagationSpeed',physconst('Lightspeed'));

Process both waveforms.

rect_out = comprlib(rectwav,1); lfm_out = comprlib(lfmwav,2); nsamp = fs/prf; t = [0:(nsamp-1)]/fs; plot(t*1000,real(rect_out)) hold on plot(t*1000,real(lfm_out)) hold off title('Pulse Compression Output') xlabel('Time (millsec)') ylabel('Amplitude')

Plot the range response of an LFM signal hitting three targets. The ranges are 2000, 4000, and 5500 meters. Assume the radar maximum range is 10 km. Set the pulse repetition interval from the maximum range.

Create the pulse waveform.

rmax = 10.0e3; c = physconst('Lightspeed'); pri = 2*rmax/c; fs = 1e6; pri = ceil(pri*fs)/fs; prf = 1/pri; nsamp = pri*fs; rxdata = zeros(nsamp,1); t1 = 2*2000/c; t2 = 2*4000/c; t3 = 2*5500/c; idx1 = floor(t1*fs); idx2 = floor(t2*fs); idx3 = floor(t3*fs); lfm = phased.LinearFMWaveform('PulseWidth',10/fs,'PRF',prf, ... 'SweepBandwidth',(30*fs)/40); w = lfm();

Imbed the waveform part of the pulse into the received signal.

x = w(1:11); rxdata(idx1:idx1+10) = x; rxdata(idx2:idx2+10) = x; rxdata(idx3:idx3+10) = x;

Create the pulse waveform library.

w1 = {'LinearFM','PulseWidth',10/fs,'PRF',prf,... 'SweepBandwidth',(30*fs)/40}; wavlib = phased.PulseWaveformLibrary('SampleRate',fs,'WaveformSpecification',{w1}); wav = wavlib(1);

Generate the range response signal.

p1 = {'MatchedFilter','Coefficients',getMatchedFilter(wavlib,1),'SpectrumWindow','None'}; idx = 1; complib = phased.PulseCompressionLibrary( ... 'WaveformSpecification',{w1},... 'ProcessingSpecification',{p1},... 'SampleRate',fs,... 'PropagationSpeed',c); y = complib(rxdata,1);

Plot range response of processed data

plotResponse(complib,rxdata,idx,'Unit','mag');

The `PRF`

property must satisfy these restrictions:

The product of

`PRF`

and`PulseWidth`

must be less than or equal to one. This condition expresses the requirement that the pulse width is less than one pulse repetition interval.The ratio of

`SampleRate`

to`PRF`

must be an integer. This condition expresses the requirement that the number of samples in one pulse repetition interval is an integer.

The values of the `ChipWidth`

and `NumChips`

properties must satisfy these constraints:

The product of

`PRF`

,`ChipWidth`

, and`NumChips`

must be less than or equal to one. This condition expresses the requirement that the sum of the durations of all chips is less than one pulse repetition interval.The product of

`SampleRate`

and`ChipWidth`

must be an integer. This condition expresses the requirement that the number of samples in a chip must be an integer.

The table shows additional constraints on the number of chips for different code types.

If the `Code` Property Is ... | Then the `NumChips` Property Must Be... |
---|---|

`'Frank'` , `'P1'` , or
`'Px'` | A perfect square. |

`'P2'` | An even number that is a perfect square. |

`'Barker'` | `2` , `3` , `4` ,
`5` , `7` , `11` , or
`13` |

Generate C and C++ code using MATLAB® Coder™.

Usage notes and limitations:

The `plotResponse`

object function is not supported for code
generation.

See System Objects in MATLAB Code Generation (MATLAB Coder).

A modified version of this example exists on your system. Do you want to open this version instead?

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.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web siteYou can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- 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)