Main Content

rfplot

Plot S-parameter data

Description

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

example

rfplot(s_obj,i,j) plots the magnitude of Si j in decibels on the current axis.

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.

example

rfplot(___,LineSpec) plots S-parameters using the line parameters specified in LineSpec.

rfplot(___,plotflag)plots S-parameters according to the type specified in plotflag.

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.

example

rfplot(s_obj,part) plots the upper or lower triangular portion of the S-parameters matrix on the current axis.

rfplot(s_obj,part,k) plots the elements on, above, or below the kth diagonal of the S-parameters matrix. For more information, see the tril and triu functions.

example

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.

hline = rfplot(___) plots the S-parameters and returns a column vector of line handles in hline.

example

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude (dB) contains 4 objects of type line. These objects represent dB(S_{11}), dB(S_{21}), dB(S_{12}), dB(S_{22}).

Plot S21.

rfplot(hs,2,1)

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude (dB) contains an object of type line. This object represents dB(S_{21}).

Plot the angle of S21 in degrees.

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Angle (degrees) contains an object of type line. This object represents angle(S_{21}).

Plot the real part of S21.

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Re(S-parameters) contains an object of type line. This object represents real(S_{21}).

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude contains 6 objects of type line. These objects represent abs(S_{12}), abs(S_{13}), abs(S_{22}), abs(S_{23}), abs(S_{32}), abs(S_{33}).

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude contains 4 objects of type line. These objects represent abs(S_{12}), abs(S_{33}), abs(S_{11}), abs(S_{22}).

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude contains 3 objects of type line. These objects represent abs(S_{11}), abs(S_{22}), abs(S_{33}).

Plot the transmission coefficients of the S-parameters.

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

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude contains 6 objects of type line. These objects represent abs(S_{12}), abs(S_{13}), abs(S_{23}), abs(S_{21}), abs(S_{31}), abs(S_{32}).

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

Sample of solid line

'--'Dashed line

Sample of dashed line

':'Dotted line

Sample of dotted line

'-.'Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

MarkerDescriptionResulting Marker
'o'Circle

Sample of circle marker

'+'Plus sign

Sample of plus sign marker

'*'Asterisk

Sample of asterisk marker

'.'Point

Sample of point marker

'x'Cross

Sample of cross marker

'_'Horizontal line

Sample of horizontal line marker

'|'Vertical line

Sample of vertical line marker

's'Square

Sample of square marker

'd'Diamond

Sample of diamond line marker

'^'Upward-pointing triangle

Sample of upward-pointing triangle marker

'v'Downward-pointing triangle

Sample of downward-pointing triangle marker

'>'Right-pointing triangle

Sample of right-pointing triangle marker

'<'Left-pointing triangle

Sample of left-pointing triangle marker

'p'Pentagram

Sample of pentagram marker

'h'Hexagram

Sample of hexagram marker

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

Sample of the color red

'green''g'[0 1 0]

Sample of the color green

'blue''b'[0 0 1]

Sample of the color blue

'cyan' 'c'[0 1 1]

Sample of the color cyan

'magenta''m'[1 0 1]

Sample of the color magenta

'yellow''y'[1 1 0]

Sample of the color yellow

'black''k'[0 0 0]

Sample of the color black

'white''w'[1 1 1]

Sample of the color white

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.

Matrix with the main diagonal labeled as k=0. Values of k greater than zero are for diagonals above the main diagonal, and values of k less than zero are for diagonals 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.

More About

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.

6-by-6 matrix with shaded elements on and above the main diagonal.

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.

6-by-6 matrix with shaded elements on and below the main diagonal

Version History

Introduced before R2006a

expand all

See Also

| (RF Toolbox) | (RF Toolbox)