Perform rational fitting to complex frequency-dependent data


Use the rational object and an interpolative algorithm to create a rational fit to frequency-dependent data.

The complex frequencies are given by the equation:

F(s) = residues(1)s-poles(1)+residues(2)s-poles(2)+...+residues(n)s-poles(n)+directtermwhere, s=j2πfreq



fit = rational(freq,data) returns a rational object with complex frequencies using the given frequency vector and network parameter data.


fit = rational(s) returns a rational object for N-port S-parameters.

fit = rational(___,tol) returns a rational object fit that satisfies a relative error tolerance.

[fit,error] = rational(___) also returns the error of the fit.

fit = rational(...,Name,Value) sets properties using one or more name-value pairs. For example, fit = rational(s,'Tolerance',-34)sets the relative error tolerance in decibels for the fit.

Input Arguments

expand all

Nonnegative frequencies, specified as a vector of nonnegative frequencies in Hz.

Data Types: double

Network parameter data, specified as a vector, a 2-D array or a 3-D array. The length of the data values must equal the length of the frequency values.

Relative error tolerance, specified as a scalar less than or equal to zero. tol value sets the input for the 'Tolerance' property.

Data Types: double

N-port S-parameters, specified as an N-by-N matrix of elements of S sharing identical poles.


expand all

Relative error tolerance, specified as a scalar less than or equal to zero.

Data Types: double

Behavior of fit for large S-parameters, specified as true or false. When true, the direct term in the fit is set to zero so that the rational fit F(S) tends to zero as S approaches infinity. When false, a nonzero direct term is allowed.

Data Types: logical

Maximum number of poles, specified as a scalar nonnegative integer.

Data Types: double

Display options for the fitting algorithm of the rational object, specified as one of the following:

  • 'off' - No display

  • 'on' - Printed information

  • 'plot' - Plots of the interpolation progress

  • 'both' - -Both printed information and plots.

Data Types: char

Object Functions

timerespTime response for rational object and rationalfit function object
steprespStep-signal response of rational object and rationalfit function object
freqrespFrequency response of rational object and rationalfit function object
impulseImpulse response for rational function object
ispassiveReturn true if rationalfit output is passive at all frequencies
makepassiveEnforce passivity of rationalfit output or a rational object
passivityPlot passivity of N-by-N rationalfit function output
generateSPICEGenerate SPICE file from rationalfit of S-parameters


collapse all

Create S-Parameters from the file named passive.s2p.

S = sparameters('passive.s2p');

Perform rational fitting of the S-parameters.

fit = rational(S);

Create an S-Parameters object from the file named default.s2p. Perform rational fitting of the S-Parameters.

S = sparameters('default.s2p');
fit = rational(S,'Display', 'plot')

fit = 
  rational with properties:

      NumPorts: 2
      NumPoles: 14
         Poles: [14x1 double]
      Residues: [2x2x14 double]
    DirectTerm: [2x2 double]
         ErrDB: -21.0060

Calculate the zeros, poles, gain, and DC gain of the rational object.

[z,p,k,dcgain] = zpk(fit)
z=2×2 cell array
    {13x1 double}    {13x1 double}
    {13x1 double}    {13x1 double}

p=2×2 cell array
    {14x1 double}    {14x1 double}
    {14x1 double}    {14x1 double}

k = 2×2
1010 ×

    4.2525    0.0285
    2.6654   -0.1416

dcgain = 2×2

   -0.0336   -0.0060
   -0.6717    0.4098

See Also

Introduced in R2020a