| Contents | Index |
Elements

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 more information about simulating RF systems, see the example, Reduce Computations by Using RF Simulation Techniques.
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 reference page for the RF Toolbox rationalfit function.
Models that contain SimRF Amplifier and Mixer blocks generate files at update time. Before you can successfully update and run models with these blocks, you have to set up a compiler by running mex -setup.
By default, SimRF software generates files in the current MATLAB folder. However, you can change the output location for these files by specifying a cache folder in the Simulink Preferences dialog box. To specify a cache folder:
Open the Simulink Preferences dialog box (File > Preferences).
Specify a location for the Simulink cache folder parameter.
For more information about the Simulink interface, see Simulink Preferences Window.

Specify the source of the data that describes the amplifier behavior. The data source must contain network parameters. The value can be Data file, S-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:
![]()
In this equation, for a rational model F(s), where 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 with properties C, A, and D that can be used to specify the Residues, Poles, and Direct feedthrough parameters.
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.
When Data source is S-parameters, specify a multidimensional array of S-parameters. The third dimension of the S-parameter array must be the same length as the vector of frequencies specified by the Frequency parameter.
Specify the frequency range of the S-parameters. Specify the units from the corresponding drop-down list.
Specify the nonzero reference impedance of the S-parameter data. The default value is 50.
Choose how to model the device represented by your S-parameters.
When you select Time domain (rationalfit), the block uses a rational function approximation during simulation. The block uses the RF Toolbox function rationalfit to produce the approximation. This approach captures transient behavior, but the rational function must be a good fit for the data in order to produce accurate results. Use the Visualization tab to compare the approximation against your data.
When you select Frequency domain, your S-parameter data is represented exactly in the frequency domain during simulation. This approach produces accurate steady-state results but does not capture transient behavior.
The default value of this parameter is Time domain (rationalfit).
Sharing poles during rational function fitting speeds up the fitting process at the expense of simulation time:
Share all poles — Fit rational functions to an S-parameter array that share poles along rows and columns of S-parameter matrices at each frequency. This option favors simulation speed over accuracy.
Share poles by columns — Fit rational functions to your S-parameter data that share poles along columns of S-parameter matrices at each frequency. This option balances accuracy and simulation speed.
Fit individually — Fit rational functions to your S-parameter data without sharing poles. This option favors accuracy over simulation speed and uses the most memory space.
The default value of this parameter is Share poles by columns.
When Data source is S-parameters, specify the relative tolerance of the rational-function algorithm. This parameter is the same as the tol argument used by the rationalfit function. If rational fitting is successful, the Relative error achieved (dB) parameter is less than or equal to the relative tolerance. The default tolerance is -30.
When S-parameter modeling is Time domain (rationalfit), the dialog box displays information about the rational function approximation of the specified S-parameter data.
The block updates the value of this parameter based on the setting of the S-parameters fitting parameter:
When S-parameters fitting is Share all poles, Number of independent fits equals 1.
When S-parameters fitting is Share poles by columns, Number of independent fits equals the number of ports of the device that the S-parameter data represent.
When S-parameters fitting is Fit individually, Number of independent fits equals the square of the number of ports of the device that the S-parameter data represent.
This parameter does not apply if you only specify S-parameter data for a single frequency.
The block updates the value of this parameter to display the number of poles of the calculated rational function for the specified S-parameter data. When you set S-parameters fitting to Share poles by columns or Fit individually, the various rational functions may have different numbes of poles. In such cases, the dialog box displays the largest number of required poles of all.
To change the number of poles required for a given set of S-parameter data:
Change the value of the Relative error desired (dB) parameter.
Click Apply.
This parameter does not apply if you only specify S-parameter data for a single frequency.
The block updates the value of this parameter to display the relative error of the calculated rational function for the specified S-parameter data. If the S-parameters fitting parameter is set to Share poles by columns or Fit individually, the relative errors of each fit may vary. In such cases, the dialog box displays the largest relative error of all.
This parameter does not apply if you only specify S-parameter data for a single frequency.

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:
On the Main tab, specify the Data source parameter and requisite data to plot.
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.
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.
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.
Click Apply.
Click Plot. The block plots your data alongside a rational function approximation.
The demo, Architectural Design of a Low-IF Receiver System, uses an S-Parameters block to model a surface acoustic wave (SAW) filter.
The demo, Comparing Time- and Frequency-Domain Simulation Options for S-Parameters, shows how to choose a selection for the S-parameter modeling parameter based on the type of behavior you want to model in your system.
Model an RF Filter Using S-Parameter Data
The model
ex_simrf_sparams
replaces the LC low-pass 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 the example, Model an RF Mixer, in the SimRF Getting Started Guide.
To run the model:
Open the model by clicking the link or by typing the model name at the Command Window prompt.
Select Simulation > Start.
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 attentuates 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 low-pass 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:
Set the Data source parameter to Rational model.
Set the Residues parameter to the variable C.
Set the Poles parameter to the variable A.
Set the Direct feedthrough parameter to the variable D.
To run the model, select Simulation > Start.
The rfmodel.rational object stores the residues, poles, and direct feedthrough data as vectors; however, the S-parameters block requires matrices for the Residues, Poles, and Direct feedthrough parameters. 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 low-pass 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:
Write the S-parameter data in this model to a data file by typing
write(hfilt.AnalyzedResult,'teefilt.s2p')
in the MATLAB Command Window.
Set the Data source parameter to Data file.
Set the Data file parameter to teefilt.s2p.
To run the model, select Simulation > Start. For more information on writing data files using RF Toolbox software, see Exporting Component Data to a File.
rationalfit | Transmission Line

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |