Main Content

sparameters

Calculate S-parameters for RF data, network, circuit, and matching network objects

Description

sobj = sparameters(filename) creates an S-parameter object sobj by importing data from the Touchstone file specified by filename.

example

sobj = sparameters(data,freq) creates an S-parameter object from the S-parameter data, data, and frequencies, freq.

sobj = sparameters(data,freq,Z0) creates an S-parameter object from the S-parameter data, data, and frequencies, freq, with a given reference impedance Z0.

sobj = sparameters(rfobj,freq) calculates the S-parameters of a RF object such as a filter object, circuit object, transmission line object, series RLC object, shunt RLC object, attenuator object or RF antenna object with the default reference impedance.

sobj = sparameters(rfobj,freq,Z0) calculates the S-parameters of a RF object such as a filter object, circuit object or transmission line object with a given reference impedance Z0.

example

sobj = sparameters(netparamobj) converts the network parameter object, netparamobj, to S-parameter object with the default reference impedance.

sobj = sparameters(netparamobj,Z0) converts the network parameter object, netparamobj, to S-parameter object with a given reference impedance, Z0.

example

sobj = sparameters(rfdataorckt) extracts network data from rfdataobj or rfcktobj and converts it into S-parameter object.

example

sobj = sparameters(mnobj) returns the S-parameters of the best created matching network, evaluated at a frequency list constructed from source and load impedance.

sobj = sparameters(mnobj,freq) returns the S-parameters of the best created matching network at each specified frequency.

sobj = sparameters(mnobj,freq,Z0) returns the S-parameters of the best created matching network at each specified frequency and characteristic impedance, Z0.

sobj = sparameters(___,circuitindices) returns an array of S-parameter objects, one object for each circuit indicated in circuitindices. Use this option with any of the input argument combinations in the previous syntaxes.

example

Examples

collapse all

Extract S-parameters from file default.s2p and plot it.

S = sparameters('default.s2p');
disp(S)
  sparameters with properties:

      Impedance: 50
       NumPorts: 2
     Parameters: [2x2x191 double]
    Frequencies: [191x1 double]

Plot the extracted S-parameters data.

rfplot(S)

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}).

Create a resistor element R50 and add it to a circuit object example2. Calculate the S-parameters of example2.

hR1 = resistor(50,'R50');
hckt1 = circuit('example2');
add(hckt1,[1 2],hR1)
setports (hckt1, [1 0],[2 0])
freq = linspace (1e3,2e3,100);
S = sparameters(hckt1,freq,100);
disp(S)
  sparameters with properties:

      Impedance: 100
       NumPorts: 2
     Parameters: [2x2x100 double]
    Frequencies: [100x1 double]

Extract Y-parameters from file default.s2p. Convert the resulting Y-parameters to S-parameters.

Y1 = yparameters('default.s2p');
S1 = sparameters(Y1,100);
disp(Y1)
  yparameters with properties:

       NumPorts: 2
     Parameters: [2x2x191 double]
    Frequencies: [191x1 double]
disp(S1)
  sparameters with properties:

      Impedance: 100
       NumPorts: 2
     Parameters: [2x2x191 double]
    Frequencies: [191x1 double]
file = 'default.s2p';
h = read(rfdata.data, file);
S = sparameters(h)
S = 
  sparameters with properties:

      Impedance: 50
       NumPorts: 2
     Parameters: [2x2x191 double]
    Frequencies: [191x1 double]

This example shows how to calculate the S-Parameters for a newly created matching network for the auto-generated circuit #2 with a reference impedance of 100 Ohm.

n       = matchingnetwork('LoadImpedance',100,'Components',3);
freq    = linspace(n.CenterFrequency-n.Bandwidth/2,n.CenterFrequency+n.Bandwidth/2);
RefZ0   = 100;
ckt_no  = 2;
s       = sparameters(n,freq,RefZ0,ckt_no)
s = 
  sparameters with properties:

      Impedance: 100
       NumPorts: 2
     Parameters: [2x2x100 double]
    Frequencies: [100x1 double]

Create an RLCG transmission line using these specifications:

  • Resistor : 100 ohms

  • Capacitor : 1 pF

rlcglinetxline = txlineRLCGLine(R=100,C=1e-12)
rlcglinetxline = 
  txlineRLCGLine: RLCGLine element

           Name: 'RLCGLine'
      Frequency: 1.0000e+09
              R: 100
              L: 0
              C: 1.0000e-12
              G: 0
       IntpType: 'Linear'
     LineLength: 0.0100
    Termination: 'NotApplicable'
       StubMode: 'NotAStub'

Calculate the S-parameters of the transmission line at 1 GHz.

sparam = sparameters(rlcglinetxline,1e9);

Define a data set and a vector of frequencies.

data = reshape(complex(1:12,13:24),2,2,[]);
freq = (1:3)*10^9;

Define the reference impedance of each port of the data.

Z0 = [50 100];

Build the S-parameters object of the data at the given frequencies freq with the vector Z0 of reference impedances. This will allow you to specify different reference impedance for each port.

S = sparameters(data,freq,Z0)
S = 
  sparameters with properties:

      Impedance: [50 100]
       NumPorts: 2
     Parameters: [2x2x3 double]
    Frequencies: [3x1 double]

Input Arguments

collapse all

S-parameter data, specified as an array of complex numbers, of size N-by-N-by-K.

RF object, specified as one of the following:

Circuit objectcircuit
RF Filter objectrffilter and lcladder.
Transmission line objects
Series and Shunt RLC objectsseriesRLC, and shuntRLC
Attenuator objectattenuator
RF antenna objectrfantenna
Phase shift objectphaseshift
IMT mixer objectmixerIMT
RF divider object (since R2023a)rfdivider
Mutual inductor object (since R2023a)mutualInductor

Network parameter object. The network parameter objects are of the type: sparameters, yparameters, zparameters, gparameters, hparameters, abcdparameters, and tparameters.

Example: S1 = sparameters(Y1,100). Y1 is a parameter object. This example converts Y-parameters to S-parameters at 100 ohms.

Touchstone data file, specified as a character vector, that contains network parameter data. filename can be the name of a file on the MATLAB® path or the full path to a file.

Example: sobj = sparameters('defaultbandpass.s2p');

S-parameter frequencies, specified as a vector of positive real numbers, sorted from smallest to largest.

Reference impedance in ohms, specified as one of the following:

  • Positive real scalar when you want to specify the same the reference impedance for all ports in the network.

  • Positive real vector of length N when you want to specify a different reference impedance for each port in the N-port network. (since R2023a)

  • Positive real vector of length K when you want to specify a different reference impedance for each in the K frequencies in the data. (since R2023a)

If the reference impedance is a vector and the number of ports N equals the number of data frequencies K, N == K, then the sparameters object will assign each element of the vector to each port of the network. To specify reference impedances for each frequency in this case, specify Z0 as a 3-D vector of length 1-by-1-by-K.

You cannot specify the Z0 argument if you are importing the S-parameters data from a file. The Z0 argument is optional and the function stores the impedance in the Impedance property of the sparameters object.

RF data or circuit object. Specify rfdataobj as either rfdata.data, or rfdata.network object or specify rfcktobj as any analyzed rfckt type object, such as rfckt.amplifier, rkckt.cascade object.

Matching network, specified as a matchingnetwork object.

Data Types: char | string

Index of the matching network circuit, specified as a scalar.

Data Types: double

Output Arguments

collapse all

S-parameter data, returned as an object. disp(sobj) returns the properties of the object:

  • NumPorts — Number of ports, specified as an integer. The function calculates this value automatically when you create the object.

  • Frequencies — S-parameter frequencies, specified as a K-by-1 vector of positive real numbers sorted from smallest to largest. The function sets this property from the filename or freq input arguments.

  • Parameters — S-parameter data, specified as an N-by-N-by-K array of complex numbers. The function sets this property from the filename or data input arguments.

  • Impedance — Reference impedance in ohms, specified as a positive real scalar. The function sets this property from the filename or Z0 input arguments. If no reference impedance is provided, the function uses a default value of 50.

Version History

Introduced in R2012a

expand all