# S-Parameters

Model S-parameter network

Elements

## Description

The S-Parameters block models a network defined by S-parameters in the SimRF™ circuit envelope simulation environment. The device can have up to four ports. For an introduction to RF simulation, see the example, Simulate High Frequency Components.

The block models S-parameter data in the SimRF environment by fitting a rational function to the specified data. For more information about rational fitting of S-parameters, see the RF Toolbox™ `rationalfit` function.

## Dialog Box and Parameters

### Main Tab

Data source

Specify the source of the data that describes the amplifier behavior. The data source must contain network parameters. The value can be `Data file`, `Network-parameters`, or `Rational model`. The default value of this parameter is `Data file`.

When you select `Rational model`, also select values for the Residues, Poles, and Direct feedthrough parameters corresponding to the equation for a rational model:

$F\left(s\right)=\left(\sum _{k=1}^{n}\frac{{C}_{k}}{s-{A}_{k}}+D\right)\begin{array}{cc},& s=j2\pi f\end{array}$

In this equation, for a rational model F(s), each Ck is the residue of the pole Ak with direct feedthrough D. The example, Model an RF Filter Using S-Parameter Data, shows how to use the RF Toolbox `rationalfit` function to create an `rfmodel.rational` object. This object has the properties `C`, `A`, and `D` that can be used to specify the Residues, Poles, and Direct feedthrough parameters.

Data file

When Data source is `Data file`, specify the name of the file that contains the S-parameter data. The file name must include the extension. If the file is not in your MATLAB® path, specify the full path to the file, or click the Browse button to locate the file. By default, this parameter specifies the data file `unitygain.s2p`.

Network parameter type

Specify the type of Network parameters: `S-parameters`, `Y-parameters`, or `Z-parameters`.

Network-parameters

When Data source is `Network-parameters`, specify a multidimensional array of network parameters. The third dimension of the S-parameter array must be the same length as the vector of frequencies specified by the Frequency parameter.

Frequency

Specify the frequency range of `Network-parameters`. Specify the units from the corresponding drop-down list.

Reference impedance (Ohms)

Specify the nonzero reference impedance of the S-parameter data. The default value is `50`.

Ground and hide negative terminals

Select this option to automatically ground and hide negative terminals in the model.

### Modeling Tab

Modeling options

SimRF provides two different ways to model S-parameters:

• Time-domain (rationalfit) technique creates an analytical rational model that approximates the whole range of the data.

• Frequency-domain computes the baseband impulse response for each carrier frequency independently. This technique is based on convolution. There is an option to specify the duration of the impulse response. For more information, see Compare Time and Frequency Domain Simulation Options for S-parameters.

• For the Amplifier and S-parameters blocks, the default value is `Time domain (rationalfit)`. For the Transmission Line block, the default value is `Frequency domain`.

`Time domain`

• Fitting options

The fitting options are `Share all poles`, ```Share poles by columns```, or `Fit individually`.

For the Amplifier block, the default value is ```Fit individually```. For the S-parameters block and Transmission Line block, the default value is ```Share all poles```.

• Relative error desired (dB)

Enter the desired relative error in decibels (dB). The default value is `-40`.

• Rational fitting results

Shows values of Number of independent fits, Number of required poles, and Relative error achieved (dB).

• When modeling using `Time domain`, the Plot in `Visualization` tab plots the data defined in `Data Source` and the values in the `rationalfit` function.

`Frequency domain`
• Automatically estimate impulse response duration

Select Automatically estimate impulse response duration to calculate impulse response duration automatically. Clear the selection to specify impulse response duration.

• When using `Frequency domain`, the Plot in `Visualization` tab plots the data defined in the `Data Source`.

To understand more about frequency domain for S-parameters, please refer to the featured example Compare Time and Frequency Domain Simulation Options for S-parameters

### Visualization Tab

For an example of using the Visualization tab, see Verify That the S-parameter Block Is Fitting a Rational Function with Acceptable Accuracy.

Source of frequency data

Frequency data source. When Source of frequency data is ```Extracted from data source```, the Data source must be set to `Data file`. Verify that the specified Data file contains frequency data.

When Source of frequency data is `User-specified`, specify a vector of frequencies in the Frequency data parameter. Also, specify units from the corresponding drop-down list.

For the Amplifier and S-parameters blocks, the default value is `Extracted from source data`. For the Transmission Line block, the default value is `User-specified`.

Plot type

Specify the type of plot that you want to produce with your data. The Plot type parameter provides the following options:

• `X-Y plane` — Generate a Cartesian plot of your data versus frequency. To create linear, semilog, or log-log plots, set the Y-axis scale and X-axis scale accordingly.

• `Polar plane` — Generate a polar plot of your data. The block plots only the range of data corresponding to the specified frequencies.

• `Z smith chart`, ```Y smith chart```, and `ZY smith chart` — Generate a Smith® chart. The block plots only the range of data corresponding to the specified frequencies.

The default value is `X-Y plane`.

Parameter #

Specify the S-parameters to plot. From the Parameter1 and Parameter2 drop-down lists, select the S-parameters that you want to plot. If you specify two parameters, the block plots both parameters in a single window.

The default value for Parameter1 is `S11`. For the Amplifier and S-parameters blocks, the default value for Parameter2 is `None`. For the Transmission Line block, the default value for Parameter2 is `S22`.

Format #

For X-Y plots, format the units of the parameters to plot from the Format1 and Format2 drop-down lists. For polar plots and Smith charts, the formats are set automatically.

The default value is `Magnitude (decibels)`.

Y-axis scale

Scale for the Y-axis.

The default value is `Linear`.

X-axis scale

Scale for the X-axis.

The default value is `Linear`.

## Examples

Model an RF Filter Using S-Parameter Data

The model `ex_simrf_sparams` replaces the LC lowpass tee filter in the model from the section, Model an RF Filter, with an S-parameters block. It reproduces the results of the original model. To recreate an S-parameter representation of the filter, the model uses MATLAB code in the `PreLoadFcn` callback to:

• Create an RF Toolbox `rfckt.lclowpasstee` object.

• Specify the filter coefficients used in the Model an RF Filter example.

• Analyze the filter object from 0 Hz to 2 GHz.

• Compute rational function coefficients using the RF Toolbox `rationalfit` function.

For information on using callbacks in SimRF models, see Model an RF Mixer.

To run the model:

1. To open this model, at the MATLAB command line, enter:

```addpath(fullfile(docroot,'toolbox','simrf','examples')) ex_simrf_sparams```

2. Select Simulation > Run.

To view the results of the simulation, double-click the scope.

The signals displayed in the scope match the results of the simulation in the Model an RF Filter section. The filter attenuates the high-frequency carrier and passes the low-frequency carrier. For more information on modeling RF components in with RF Toolbox objects, see Examples of Basic Operations with RF Toolbox Objects.

Model an RF Filter from Rational Function Coefficients

The model `ex_simrf_sparams` replaces the LC lowpass tee filter in the model from the section, Model an RF Filter, with an S-parameters block. It reproduces the results of the original model. To configure the S-parameters block in this model to simulate the same filter from rational function coefficients:

1. Set the Data source parameter to `Rational model`.

2. Set the Residues parameter to the variable `C`.

3. Set the Poles parameter to the variable `A`.

4. Set the Direct feedthrough parameter to the variable `D`.

To open this model, at the MATLAB command line, enter:

```addpath(fullfile(docroot,'toolbox','simrf','examples')) ex_simrf_sparams```

To run the model, select Simulation > Run.

The `rfmodel.rational` object stores the residues, poles, and direct feedthrough data as vectors. However, because the S-parameters block requires matrices for the Residues, Poles, and Direct feedthrough parameters, rearrangement is necessary. To rearrange the vectors into matrices in the required format, the initialization function of the model transposes the output of the `reshape` function. For more information on rational function fitting with RF Toolbox software, see the `rationalfit` reference page.

Model an RF Filter from an S2P Data File

The model `ex_simrf_sparams` replaces the LC lowpass tee filter in the model from the section, Model an RF Filter, with an S-parameters block. It reproduces the results of the original model. To configure the S-parameters block in this model to simulate the same filter from an S2P data file:

1. Write the S-parameter data in this model to a data file. To do so, in the MATLAB Command Window, type:

`write(hfilt.AnalyzedResult,'teefilt.s2p')`

2. Set the Data source parameter to `Data file`.

3. Set the Data file parameter to `teefilt.s2p`.

To open this model, at the MATLAB command line, enter:

```addpath(fullfile(docroot,'toolbox','simrf','examples')) ex_simrf_sparams```

To run the model, select Simulation > Run. For more information on writing data files using RF Toolbox software, see Exporting Component Data to a File.

Verify That the S-parameter Block Is Fitting a Rational Function with Acceptable Accuracy

The S-Parameters block provides a visualization tool for validating RF-component data modeling. Use the visualization tool to verify that the S-parameter block is fitting a rational function with acceptable accuracy. To produce a data plot:

1. On the Main tab, specify the Data source parameter and requisite data to plot.

2. Specify frequency data:

• When Source of frequency data is ```Extracted from data source```, the Data source must be set to `Data file`, and the specified Data file must contain frequency data.

• When Source of frequency data is `User-specified`, specify a vector of frequencies in the Frequency data parameter.

Also, specify units from the corresponding drop-down list.

3. Specify the type of plot that you want to produce with your data. The Plot type parameter provides the following options:

• `X-Y plane` — Generate a Cartesian plot of your data versus frequency. To create linear, semilog, or log-log plots, set the Y-axis scale and X-axis scale accordingly.

• `Polar plane` — Generate a polar plot of your data. The block plots only the range of data corresponding to the specified frequencies.

• `Z smith chart`, ```Y smith chart```, and `ZY smith chart` — Generate a Smith chart. The block plots only the range of data corresponding to the specified frequencies.

4. Specify the S-parameters to plot. From the Parameter1 and Parameter2 drop-down lists, select the S-parameters that you want to plot. If you specify two parameters, the block plots both parameters in a single window.

For X-Y plots, format the units of the parameters to plot from the Format1 and Format2 drop-down lists. For polar plots and Smith charts, the formats are set automatically.

5. Click Apply.

6. Click Plot. The block plots your data and a rational function approximation.