Create a library of pulse waveforms
The phased.PulseWaveformLibrary
System object™ creates a library of pulse
waveforms. The waveforms in the library can be of different types or be of the same type with
different parameters. You can use this library to transmit different kinds of pulses during a
simulation.
To make a waveform library
Create the phased.PulseWaveformLibrary
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 library of pulse waveforms,
pulselib
= phased.PulseWaveformLibrarypulselib
, with default property values. The default consists of a
rectangular waveform and a linear FM waveform.
creates a pulse waveform library with each property pulselib
= phased.PulseWaveformLibrary(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.
pulselib =
phased.PulseWaveformLibrary('SampleRate',1e9,'WaveformSpecification',{{'Rectangular','PRF',1e4,'PulseWidth',100e-6},{'SteppedFM','PRF',1e4}})
creates a library containing one rectangular waveform and one stepped-FM waveform, both
sampled at 1 GHz.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 rate1e6
(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
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, ...}
Waveform Types
Waveform type | Waveform 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
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 frequency1e4
(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 duration5e-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 cycle0.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 sweep1e5
(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 pulse0
(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 frequency1e4
(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 index1
(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 duration1e-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 waveform4
(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 pulse0
(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 frequency1e4
(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 duration5e-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 cycle0.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 pulse0
(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
.
{'SteppedFM','PRF',10e-4}
PRF
— Pulse repetition frequency1e4
(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 duration5e-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 cycle0.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 waveform5
(default) | positive integerNumber of frequency steps in waveform, specified as a positive integer.
Example: 3
Data Types: double
FrequencyStep
— Linear frequency step size20e3
(default) | positive scalarLinear frequency step size, specified as a positive scalar.
Example: 100.0
Data Types: double
FrequencyOffset
— Frequency offset of pulse0
(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
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}
idx
— Index of the waveform in the waveform libraryIndex of the waveform in the waveform library, specified as a positive integer.
Example: 2
Data Types: double
waveform
— Waveform samplesWaveform samples, returned as a complex-valued vector.
Data Types: double
Complex Number Support: Yes
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)
getMatchedFilter | Matched filter coefficients for pulse waveform |
plot | Plot waveform from waveform library |
Construct a waveform library consisting of three waveforms. The library contains a rectangular, a linear FM, and a phase-coded waveform. Then, obtain and plot the real and imaginary parts of the phase-coded waveform.
waveform1 = {'Rectangular','PRF',1e4,'PulseWidth', 50e-6}; waveform2 = {'LinearFM','PRF',1e4,'PulseWidth',50e-6, ... 'SweepBandwidth',1e5,'SweepDirection','Up',... 'SweepInterval', 'Positive'}; waveform3 = {'PhaseCoded','PRF',1e4,'Code','Zadoff-Chu', ... 'SequenceIndex',3,'ChipWidth',5e-6,'NumChips',8}; fs = 1e6; wavlib = phased.PulseWaveformLibrary('SampleRate',fs, ... 'WaveformSpecification',{waveform1,waveform2,waveform3});
Extract the waveform from the library.
wav3 = wavlib(3);
Plot the waveform using the plot
method.
plot(wavlib,3,'PlotType','complex')
Construct a waveform library consisting of three waveforms. The library contains one rectangular, one linear FM, and one stepped-FM waveforms. Then, plot the real parts of the first three pulses of the stepped-fm waveform.
waveform1 = {'Rectangular','PRF',1e4,'PulseWidth',70e-6}; waveform2 = {'LinearFM','PRF',1e4,'PulseWidth',70e-6, ... 'SweepBandwidth',1e5,'SweepDirection','Up',... 'SweepInterval', 'Positive'}; waveform3 = {'SteppedFM','PRF',1e4,'PulseWidth', 70e-6,'NumSteps',5, ... 'FrequencyStep',50000,'FrequencyOffset',0}; fs = 1e6; wavlib = phased.PulseWaveformLibrary('SampleRate',fs, ... 'WaveformSpecification',{waveform1,waveform2,waveform3});
Plot the first three pulses of the waveform using the plot
method.
plot(wavlib,3,'PulseIdx',1)
plot(wavlib,3,'PulseIdx',2)
plot(wavlib,3,'PulseIdx',3)
This example shows how to put two waveforms into a waveform library and how to extract and plot their matched filter coefficients.
Create a pulse library consisting of a rectangular and a linear FM waveform.
waveform1 = {'Rectangular','PRF',10e3 'PulseWidth',50e-6}; waveform2 = {'LinearFM','PRF',10e3,'PulseWidth',50e-6,'SweepBandwidth',1e5, ... 'SweepDirection','Up','SweepInterval', 'Positive'}; pulsesib = phased.PulseWaveformLibrary('SampleRate',1e6,... 'WaveformSpecification',{waveform1,waveform2});
Retrieve the matched filter coefficients for each waveform and plot their real parts.
coeff1 = getMatchedFilter(pulsesib,1,1); subplot(2,1,1) stem(real(coeff1)) title('Matched filter coefficients, real part') coeff2 = getMatchedFilter(pulsesib,2,1); subplot(2,1,2) stem(real(coeff2)) title('Matched filter coefficients, real part')
Define a custom hyperbolic FM waveform and add it to a phased.PulseWaveformLibrary
System object together with a linear FM waveform. Plot the hyperbolic waveform.
Specify the hyperbolic FM waveform parameters. The pulse width is 75 ms and the pulse repetition interval is 100 ms. The center frequency is 500 Hz and the bandwidth is 400 Hz.
fs = 50e3; pri = 0.1; prf = 1/pri; freq = 1000; pw = 0.075; bw = 400.0; fcent = 500.0;
Create a pulse waveform library consisting of a hyperbolic FM waveform and a linear FM waveform.
pulselib = phased.PulseWaveformLibrary('SampleRate',fs, ... 'WaveformSpecification',{{@HyperbolicFM,prf,pw,freq,bw,fcent}, ... {'LinearFM','PRF',prf,'PulseWidth',pw, ... 'SweepBandwidth',bw,'SweepDirection','Up',... 'SweepInterval','Positive'}});
Plot the complex hyperbolic FM waveform.
plot(pulselib,1,'PlotType','complex')
Define the Hyperbolic FM waveform function.
function y = HyperbolicFM(fs,prf,pw,freq,bw,fcent) pri = 1/prf; t = [0:1/fs:pri]'; idx = find(t <= pw); fl = fcent - bw/2; fh = fcent + bw/2; y = zeros(size(t)); arg = 2*pi*fl*fh/bw*pw*log(1.0 - bw*t(idx)/fh/pw); y(idx) = exp(1i*arg); end
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 |
Usage notes and limitations:
The plot
object function is not supported.
See System Objects in MATLAB Code Generation (MATLAB Coder).
You have a modified version of this example. Do you want to open this example with your edits?