# plot

Plot waveform from waveform library

Since R2021a

## Syntax

``plot(pulselib,idx)``
``plot(pulselib,idx,'PlotType',Type)``
``plot(___,'PulseIdx',pidx)``
``plot(___,LineSpec)``
``hndl = plot(___)``

## Description

example

````plot(pulselib,idx)` plots the real part of the waveform specified by `idx` belonging to the pulse waveform library, `pulselib`.```

example

````plot(pulselib,idx,'PlotType',Type)` also specifies whether to plot the real and/or imaginary parts of the waveform using the (`'PlotType'`,`Type`) name-value pair argument.```

example

````plot(___,'PulseIdx',pidx)` also specifies the index, `pidx`, of the pulse to plot using the (`'PulseIdx'`,`pidx`) name-value pair argument.```

example

````plot(___,LineSpec)` specifies the line color, line style, or marker options. These options are the same options found in the MATLAB® `plot` function. When both real and imaginary plots are specified, the `LineSpec` applies to both subplots. This argument is always the last input to the method.```
````hndl = plot(___)` returns the line handle, `hndl`, in the figure. ```

## Examples

collapse all

Construct a waveform library consisting of three waveforms. The library contains one rectangular waveform, one linear FM waveform, and one 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 = pulseWaveformLibrary('SampleRate',fs, ... 'WaveformSpecification',{waveform1,waveform2,waveform3});```

Plot the linear FM waveform using the `plot` method.

`plot(wavlib,2)`

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

Construct a waveform library consisting of three waveforms. The library contains one rectangular, one linear FM, and one stepped-FM waveforms. Then, plot the linear 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 = pulseWaveformLibrary('SampleRate',fs, ... 'WaveformSpecification',{waveform1,waveform2,waveform3});```

Plot the waveform using the `plot` method.

`plot(wavlib,2,':')`

## Input Arguments

collapse all

Waveform library, specified as a `pulseWaveformLibrary` System object.

Index of waveform in pulse waveform library, specified as a positive integer.

Example: `3`

Data Types: `double`

Plot type, specified as `'real'`, `'imag'`,or `'complex'`. Use this argument in the `'Type'` name-value pair.

Data Types: `char` | `string`

Index of plot to pulse, specified as a positive integer. Use this argument in the `'PulseIdx'` name-value pair. This argument only affects the stepped-FM waveform.

Data Types: `double`

Line color, style, and marker options, specified as a character vector. These options are the same as for the MATLAB `plot` function. If you specify a `PlotType` value of `'complex'`, then `LineSpec` applies to both the real and imaginary subplots.

Example: `'ko'`

Data Types: `char`

### Name-Value Arguments

Example: `'PlotType','imag'`

Components of waveform, specified as `'real'`, `'imag'`, or `'complex'`.

Example: `'complex'`

Data Types: `char`

Plot stepped FM waveform subpulse, specified as a positive integer. This argument only affects the stepped-FM waveform.

Example: `5`

Data Types: `double`

## Output Arguments

collapse all

Handle of lines in figure, returned as a scalar or 2-by-1 real-valued vector. For the case when both real and imaginary plots are specified, the vector includes handles to the lines in both subplots, in the form of `[RealLineHandle;ImagLineHandle]`.

## Version History

Introduced in R2021a