# rfplot

Plot S-parameter data

## Syntax

``rfplot(s_obj)``
``rfplot(s_obj,i,j)``
``rfplot(s_obj,[i1:in],[j1:jn])``
``rfplot(s_obj,{[i1 j1];...;[in jn]})``
``rfplot(___,LineSpec)``
``rfplot(___,plotflag)``
``rfplot(s_obj,'diag')``
``rfplot(s_obj,part)``
``rfplot(s_obj,part,k)``
``rfplot(ax,___)``
``hline = rfplot(___)``
``[hline,haxes] = rfplot(filter,frequencies)``

## Description

example

````rfplot(s_obj)` plots the magnitude in decibels versus frequency of all S-parameters (S11, S12 ... SNN) on the current axes.```
````rfplot(s_obj,i,j)` plots the magnitude of Si j in decibels on the current axis. ```

example

````rfplot(s_obj,[i1:in],[j1:jn])` plots the magnitude of multiple S-parameters in decibels on the current axis. ```

example

````rfplot(s_obj,{[i1 j1];...;[in jn]})` plots the magnitude of specific S-parameters in decibels on the current axis. ```
````rfplot(___,LineSpec)` plots S-parameters using the line parameters specified in `LineSpec`.```
````rfplot(___,plotflag)`plots S-parameters according to the type specified in `plotflag`.```

example

````rfplot(s_obj,'diag')` plots the magnitude of Si i reflection coefficients or the diagonal elements of the S-parameter matrix `'diag'` on the current axis. ```
````rfplot(s_obj,part)` plots the upper or lower triangular portion of the S-parameters matrix on the current axis. ```

example

````rfplot(s_obj,part,k)` plots the elements on, above, or below the `k`th diagonal of the S-parameters matrix. For more information, see the `tril` and `triu` functions.```
````rfplot(ax,___)` plots the S-parameters on the axes specified in `ax` instead of the current axes. Specify `ax` as the first input argument followed by any of the input argument combinations in the previous syntaxes. Return the current axes using the `gca` function.```

example

````hline = rfplot(___)` plots the S-parameters and returns a column vector of line handles in `hline`.```
````[hline,haxes] = rfplot(filter,frequencies)` plots the magnitude response of the S-parameters of the RF filter.```

## Examples

collapse all

Use the `sparameters` function to create a set S-parameters.

`hs = sparameters('default.s2p');`

Plot all the S-parameters.

`rfplot(hs)`

Plot S21.

`rfplot(hs,2,1)`

Plot the angle of S21 in degrees.

`rfplot(hs,2,1,'angle')`

Plot the real part of S21.

`rfplot(hs,2,1,'real')`

Create an S-parameter object from a three-port Touchstone file.

`sobj = sparameters('default.s3p');`

Plot S12, S13, S22, S23, S32, and S33.

`rfplot(sobj,[1:3],[2:3],'abs')`

Create an S-parameter object from a three-port Touchstone file.

`sobj = sparameters('default.s3p');`

Plot S12, S33, S11, and S22.

`rfplot(sobj,{[1 2]; [3 3]; [1 1]; [2 2]},'abs') `

Create an S-parameter object from a three-port Touchstone file.

`sobj = sparameters('default.s3p');`

Plot the reflection coefficients of the S-parameters.

`rfplot(sobj,'diag','abs')`

Plot the transmission coefficients of the S-parameters.

```rfplot(sobj,'triu',1,'abs') hold on rfplot(sobj,'tril',-1,'abs')```

## Input Arguments

collapse all

S-parameters, specified as RF Toolbox™ network parameter object. To create this type of object, use the `sparameters` function.

Row index of the data to plot, specified as a scalar, vector, or cell array.

Type of PlotHow to Specify Indices
Single parameter

Specify `i` and ```j ```as scalars.

``` rfplot(s_obj,[1,2])```

Set of parameters

Specify `i` and `j` as vectors.

`rfplot(s_obj,[1:3],[2:3])`

`rfplot(s_obj,[1,2],[2,3])`

Specific parameters

Specify a cell array of `i` and `j` scalars.

``` rfplot(s_obj, {[1 2];[2 3]})```

Column index of the data to plot, specified as a scalar, vector, or cell array.

Type of PlotHow to Specify Indices
Single parameter

Specify `i` and ```j ```as scalars.

``` rfplot(s_obj,[1,2])```

Set of parameters

Specify `i` and `j` as vectors.

`rfplot(s_obj,[1:3],[2:3])`

`rfplot(s_obj,[1,2],[2,3])`

Specific parameters

Specify a cell array of `i` and `j` scalars.

``` rfplot(s_obj, {[1 2];[2 3]})```

Line style, marker, and color, specified as a character vector or a string containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.

Example: `'--or'`creates a dashed line in red with circular markers

Line StyleDescriptionResulting Line
`'-'`Solid line

`'--'`Dashed line

`':'`Dotted line

`'-.'`Dash-dotted line

MarkerDescriptionResulting Marker
`'o'`Circle

`'+'`Plus sign

`'*'`Asterisk

`'.'`Point

`'x'`Cross

`'_'`Horizontal line

`'|'`Vertical line

`'s'`Square

`'d'`Diamond

`'^'`Upward-pointing triangle

`'v'`Downward-pointing triangle

`'>'`Right-pointing triangle

`'<'`Left-pointing triangle

`'p'`Pentagram

`'h'`Hexagram

Color NameShort NameRGB TripletAppearance
`'red'``'r'``[1 0 0]`

`'green'``'g'``[0 1 0]`

`'blue'``'b'``[0 0 1]`

`'cyan'` `'c'``[0 1 1]`

`'magenta'``'m'``[1 0 1]`

`'yellow'``'y'``[1 1 0]`

`'black'``'k'``[0 0 0]`

`'white'``'w'``[1 1 1]`

Plot types, specified as either `'db'`, `'real'`, `'imag'`, `'abs'`, or `'angle'`.

Example: `'angle'`

RF filter, specified as an `rffilter` (RF Toolbox) object or an `lcladder` (RF Toolbox) object.

Frequencies to plot magnitude response, specified as a vector.

Portion of the S-parameters matrix, specified as `'triu'` or `'tril'`. Specify `triu `to plot the Upper Triangular (RF Toolbox) portion of the matrix and `tril `to plot the Lower Triangular (RF Toolbox) portion.

Diagonals to include, specified as a scalar.

• `k = 0` specifies the main diagonal.

• `k > 0` specifies a diagonal above the main diagonal.

• `k < 0` specifies a diagonal below the main diagonal.

Axes object, specified as an `axes` or a `uiaxes` object.

## Output Arguments

collapse all

Line containing the S-parameter plot, returned as a line handle.

Axes of the `rfplot`, returned as an axes handle.

collapse all

### Upper Triangular

The upper triangular portion of a matrix includes the main diagonal and all elements above it. The shaded elements in this graphic depict the upper triangular portion of a 6-by-6 matrix.

### Lower Triangular

The lower triangular portion of a matrix includes the main diagonal and all elements below it. The shaded elements in this graphic depict the lower triangular portion of a 6-by-6 matrix.

## Version History

Introduced before R2006a

expand all