Engee documentation

rational

Performs a rational approximation of complex frequency-dependent data.

Library

EngeeRF

Description

Use the function rational to perform a rational approximation of complex frequency-dependent data. This function uses the AAA algorithm [1] to construct a rational approximation with complex frequencies . The AAA algorithm uses a barycentric shape to solve scaling problems encountered by other rational approximation methods, in particular, the widely used vector approximation algorithm. This allows the AAA algorithm to quickly converge to an almost optimal rational approximation function. Approximation of each element of the function rational is given by the following equation:

where

  • — deductions;

  • — poles;

  • — free member.

Syntax

Function call

  • fit = rational() — creates a non-reflective single-port object rational, whose properties are set by default.

  • fit = rational(freq,data) — performs a rational approximation for a given frequency vector freq and network parameter data data.

  • fit = rational(s) — performs a rational approximation for an N-port object of S-parameters s.

  • fit = rational(filename) — performs a rational approximation of network data from the file specified in the argument filename.

  • fit = rational(___,tol) — performs a rational approximation, trying to satisfy a given relative error tol.

  • fit = rational(___,Name=Value) — sets parameters for controlling aspects of approximation or sets object properties rational using arguments like «name-value».

Arguments

Input arguments

# freq — non- negative frequencies

+ vector

Details

Non-negative frequencies in Hz, specified as a vector.

Типы данных

Float64

# data — network parameter data

+ vector | array

Details

Network parameter data set as a vector, two-dimensional, or three-dimensional array. The length of the data values must be equal to the length of the frequency values. freq.

# s — N-port S-parameters

+ the sparameters object

Details

N-port S-parameters set as an object sparameters.

# filename is the name of the network data file

+ line

Details

The name of the network data file specified as a string. The data file must have the extension .snp (Touchstone file).

# tol — permissible relative error

+ −40 (by default) | scalar

Details

Acceptable relative error, set as a scalar, less than or equal to 0 dB.

Do not specify an input argument tol and the type argument «name-value» Tolerance when specifying the number of approximation poles using the argument NumPoles.

Input arguments «name-value»

Specify optional argument pairs as Name=Value, where Name — the name of the argument, and Value — the appropriate value. Type arguments «name-value» they should be placed after the other arguments, but the order of the pairs does not matter.

Example: fit = rational(s, MaxPoles = 1002) sets the maximum number of poles for the approximation. You can specify multiple pairs «name-value».

# Tolerance — acceptable relative error

+ −40 (by default) | scalar

Details

Acceptable relative error, set as a scalar, less than or equal to 0 dB.

Do not specify an input argument tol and the type argument «name-value» Tolerance when specifying the number of approximation poles using the argument NumPoles.
Типы данных

Float64

# TendsToZero — approximation behavior for large values of S-parameters

+ true (by default) | false

Details

Approximation behavior for large S-parameters, specified by one of the logical values:

  • true — the free term in the approximation is zeroed, so that the rational approximation it tends to zero as it approaches Towards infinity;

  • false — a non-zero free member is allowed.

Типы данных

Bool

# MaxPoles — maximum number of poles

+ 1000 (by default) | scalar

Details

The maximum number of poles, set as a non-negative integer.

Типы данных

Int64

# ErrorMetric — error metric in the object rational
"default" (by default) | "Relative"

Details

Error metric in the object rational, set using one of the following methods:

  • "default" — object rational it will distribute the error evenly.;

  • "Relative" — object rational it will match both peaks and troughs, or get a smaller error for smaller values.

Типы данных

Symbol

# NoiseFloor — ignoring low-level noise in data

+ −Inf (by default) | scalar

Details

An argument that allows you to ignore low-level noise in the data, set as a scalar.

Типы данных

Float64

# Causal — pole stability

+ true (by default) | false

Details

Pole stability, set by one of the logical values:

  • true — all poles of the approximation are stable;

  • false — the poles can be located at any point of the complex plane.

Типы данных

Bool

# Qlimit — maximum value of the quality factor

+ 1000 (by default) | scalar

Details

The maximum value of the quality coefficient of the approximation poles, set as a positive scalar.

Типы данных

Float64

# ColumnReduce — data reduction

+ true (by default) | false

Details

Data reduction specified by one of the logical values:

  • true — The function reduces data for the handler to save memory and computing time.;

  • false — Saving memory and computing time is not activated.

Типы данных

Bool

# PoleSharing — type of pole distribution

+ All (by default) | Column | Individual

Details

The type of pole distribution for the S-parameters, set by one of the following values:

  • All — distribution of all poles of the S-parameters;

  • Column — distribution of poles by columns of S-parameters;

  • Individual — the distribution of poles according to individual S-parameters.

Типы данных

Symbol, String

# Display — display parameters of the approximation algorithm

+ "off" (by default) | "on" | "plot" | "both"

Details

Display parameters of the object approximation algorithm rational, set to one of the following values:

  • "off" — there is no display;

  • "on" — information;

  • "plot" — graphs of the interpolation process;

  • "both" — output of both information and graphs.

Типы данных

Symbol


# Delay — delay of the frequency response

+ [0.0;;] (default) | the matrix

Details

The time delay of the frequency response, set as a matrix.

Типы данных

Float64

# DirectTerm is a free term in the approximation

+ [0.0;;] (by default) | the matrix

Details

The free term in the approximation or the value in the equation given in description, given as a two-dimensional matrix. The length of this matrix must match the first two dimensions of the argument. data. If you set this argument, the object will set the argument ErrDB.

This argument must be set along with the arguments Poles and Residues.

If you do not specify this argument, the object will automatically set a value for it in the form of a two-dimensional matrix with the size NumPorts on NumPorts.

Типы данных

Float64

# ErrDB — error between approximation and source data

+ −Inf (by default) | scalar

Details

The error between the approximation and the initial data, specified as a scalar in dB.

This argument is read-only.
Типы данных

Float64

# NumPoles — number of poles

+ 0 (by default) | scalar

Details

The number of poles in the approximation, set as a non-negative integer. If the argument is NumPoles If it is not specified, the object sets its value automatically.

Do not specify an input argument tol and the type argument «name-value» Tolerance when specifying the number of approximation poles using the argument NumPoles.
Типы данных

Int64

# NumPorts — number of ports

+ 1 (by default) | vector

Details

The number of ports in the source data of the S-parameters, specified as a vector of size 1 on 2. The value of the argument NumPorts It is determined based on the S-parameter data.

This argument is read-only.
Типы данных

Int64

# Poles — poles of approximation

+ [] (by default) | vector

Details

Poles approximations specified as a vector string of size NumPoles on 1. If this argument is set, the object sets the arguments Residues, DirectTerm and ErrDB, or you can set them separately.

If the argument is Poles If it is not specified, the object sets its value automatically.

When setting the fitting poles using the argument Poles arguments NoiseFloor, Causal, ColumnReduce, MaxPoles, NumPoles and Qlimit they are ignored.
Типы данных

ComplexF64

# Remains — approximation deductions

+ array

Details

Deductions approximations defined as a three-dimensional array. The first two dimensions of the array Residues must have the same length as the first two dimensions of the argument. data, and the last dimension of the array Residues must have the same length as the argument. Poles. If this argument is set, the object sets the arguments DirectTerm, ErrDB, or you can set them separately.

If the argument is Residues If the object is not specified, it will automatically set a value for it in the form of a three-dimensional matrix with the size NumPorts on NumPorts on NumPoles.

Типы данных

ComplexF64

Output arguments

# fit — calculated rational approximation

+ the rational object

Details

The calculated rational approximation of complex frequency-dependent data returned as an object rational.

Examples

Approximation of S-parameters

Details

Calculate the S-parameters for the schema object example with a resistor R50.

using EngeeRF

hR1 = resistor(50, "R50")
hckt1 = circuit("example")
add(hckt1, [1 2], hR1)
setports(hckt1, [1 0], [2 0])
freq = range(1e3, 2e3, length = 10)
S = sparameters(hckt1, freq, 100)

Let’s perform a rational approximation of the S-parameters and derive the properties of the object. rational.

fit = rational(S)

println("Delay: ", fit.Delay,
        "\nDirectTerm: ", fit.DirectTerm,
        "\nErrDB: ", fit.ErrDB,
        "\nNumPoles: ", fit.NumPoles,
        "\nNumPorts: ", fit.NumPorts,
        "\nPoles: ", fit.Poles,
        "\nResidues: ", fit.Residues)
Delay: [0.0 0.0; 0.0 0.0]
DirectTerm: [0.0 0.0; 0.0 0.0]
ErrDB: -70.0044060037275
NumPoles: 8
NumPorts: 2
Poles: ComplexF64[-19618.734058480502 + 0.0im, -17016.082839453717 + 0.0im, -14758.703305527004 + 0.0im, -12800.791187707133 + 0.0im, -11102.61868127103 + 0.0im, -9629.7283327366 + 0.0im, -8352.233867019033 + 0.0im, -7244.213767924145 + 0.0im]
Residues: ComplexF64[9.824070000137314e6 + 0.0im 3.929628000055413e7 + 0.0im; 3.9296280000553586e7 + 0.0im 9.824070000137314e6 + 0.0im;;; -4.441693985381927e7 + 0.0im -1.7766775941529915e8 + 0.0im; -1.776677594152968e8 + 0.0im -4.441693985381927e7 + 0.0im;;; 8.972096693535988e7 + 0.0im 3.5888386774148345e8 + 0.0im; 3.588838677414788e8 + 0.0im 8.972096693535988e7 + 0.0im;;; -1.0574206264507577e8 + 0.0im -4.229682505803536e8 + 0.0im; -4.229682505803484e8 + 0.0im -1.0574206264507577e8 + 0.0im;;; 7.903143194708505e7 + 0.0im 3.1612572778837645e8 + 0.0im; 3.1612572778837293e8 + 0.0im 7.903143194708505e7 + 0.0im;;; -3.763439152535831e7 + 0.0im -1.5053756610144946e8 + 0.0im; -1.5053756610144803e8 + 0.0im -3.763439152535831e7 + 0.0im;;; 1.059884870604168e7 + 0.0im 4.239539482417094e7 + 0.0im; 4.239539482417063e7 + 0.0im 1.059884870604168e7 + 0.0im;;; -1.3618189431558964e6 + 0.0im -5.447275772624157e6 + 0.0im; -5.447275772624077e6 + 0.0im -1.3618189431558964e6 + 0.0im]

Pole control in the facility rational

Details

Creating an S-parameter object.

using EngeeRF

hR1 = resistor(50, "R50")
hckt = circuit()
add(hckt, [1 2], hR1)
freq = range(1e3, 2e3, length = 10)
S = sparameters(hckt1, freq, 100)

Let’s perform a rational approximation by default.

fit = rational(S)

println("Delay: ", fit.Delay,
        "\nDirectTerm: ", fit.DirectTerm,
        "\nErrDB: ", fit.ErrDB,
        "\nNumPoles: ", fit.NumPoles,
        "\nNumPorts: ", fit.NumPorts,
        "\nPoles: ", fit.Poles,
        "\nResidues: ", fit.Residues)
Delay: [0.0 0.0; 0.0 0.0]
DirectTerm: [0.0 0.0; 0.0 0.0]
ErrDB: -70.0044060037275
NumPoles: 8
NumPorts: 2
Poles: ComplexF64[-19618.734058480502 + 0.0im, -17016.082839453717 + 0.0im, -14758.703305527004 + 0.0im, -12800.791187707133 + 0.0im, -11102.61868127103 + 0.0im, -9629.7283327366 + 0.0im, -8352.233867019033 + 0.0im, -7244.213767924145 + 0.0im]
Residues: ComplexF64[9.824070000137314e6 + 0.0im 3.929628000055413e7 + 0.0im; 3.9296280000553586e7 + 0.0im 9.824070000137314e6 + 0.0im;;; -4.441693985381927e7 + 0.0im -1.7766775941529915e8 + 0.0im; -1.776677594152968e8 + 0.0im -4.441693985381927e7 + 0.0im;;; 8.972096693535988e7 + 0.0im 3.5888386774148345e8 + 0.0im; 3.588838677414788e8 + 0.0im 8.972096693535988e7 + 0.0im;;; -1.0574206264507577e8 + 0.0im -4.229682505803536e8 + 0.0im; -4.229682505803484e8 + 0.0im -1.0574206264507577e8 + 0.0im;;; 7.903143194708505e7 + 0.0im 3.1612572778837645e8 + 0.0im; 3.1612572778837293e8 + 0.0im 7.903143194708505e7 + 0.0im;;; -3.763439152535831e7 + 0.0im -1.5053756610144946e8 + 0.0im; -1.5053756610144803e8 + 0.0im -3.763439152535831e7 + 0.0im;;; 1.059884870604168e7 + 0.0im 4.239539482417094e7 + 0.0im; 4.239539482417063e7 + 0.0im 1.059884870604168e7 + 0.0im;;; -1.3618189431558964e6 + 0.0im -5.447275772624157e6 + 0.0im; -5.447275772624077e6 + 0.0im -1.3618189431558964e6 + 0.0im]

Let’s limit the number of poles to four and note that the error in fit1 higher than the error in fit.

fit1 = rational(S, NumPoles = 4)

println("Delay: ", fit1.Delay,
        "\nDirectTerm: ", fit1.DirectTerm,
        "\nErrDB: ", fit1.ErrDB,
        "\nNumPoles: ", fit1.NumPoles,
        "\nNumPorts: ", fit1.NumPorts,
        "\nPoles: ", fit1.Poles,
        "\nResidues: ", fit1.Residues)
Delay: [0.0 0.0; 0.0 0.0]
DirectTerm: [0.0 0.0; 0.0 0.0]
ErrDB: -36.73200528819233
NumPoles: 4
NumPorts: 2
Poles: ComplexF64[-20106.192982974677 + 0.0im, -16421.270078345475 + 0.0im, -11921.505918955323 + 0.0im, -8654.769253390557 + 0.0im]
Residues: ComplexF64[140272.17338248386 + 0.0im 561088.6935299853 + 0.0im; 561088.6935299853 + 0.0im 140272.17338248386 + 0.0im;;; -198002.15639575062 + 0.0im -792008.6255830727 + 0.0im; -792008.6255830729 + 0.0im -198002.15639575062 + 0.0im;;; 86786.17118317388 + 0.0im 347144.6847327263 + 0.0im; 347144.68473272637 + 0.0im 86786.17118317388 + 0.0im;;; -17635.440523174977 + 0.0im -70541.76209270621 + 0.0im; -70541.7620927062 + 0.0im -17635.440523174977 + 0.0im]

Let the object rational uses twice as many poles as in fit. Please note that the error in fit2 lower than in fit.

fit2 = rational(S, NumPoles = 2 * fit.NumPoles)

println("Delay: ", fit2.Delay,
        "\nDirectTerm: ", fit2.DirectTerm,
        "\nErrDB: ", fit2.ErrDB,
        "\nNumPoles: ", fit2.NumPoles,
        "\nNumPorts: ", fit2.NumPorts,
        "\nPoles: ", fit2.Poles,
        "\nResidues: ", fit2.Residues)
Delay: [0.0 0.0; 0.0 0.0]
DirectTerm: [0.0 0.0; 0.0 0.0]
ErrDB: -112.62617734539667
NumPoles: 16
NumPorts: 2
Poles: ComplexF64[-20977.739719155164 + 0.0im, -19455.169375359666 + 0.0im, -18043.107622234136 + 0.0im, -16733.53371468684 + 0.0im, -15519.009055596898 + 0.0im, -14392.634943348294 + 0.0im, -13348.013386059776 + 0.0im, -12379.210759929256 + 0.0im, -11480.724105265892 + 0.0im, -10647.44986876583 + 0.0im, -9874.654914482498 + 0.0im, -9157.949638828946 + 0.0im, -8493.263036901022 + 0.0im, -7876.81957849392 + 0.0im, -7305.117762464063 + 0.0im, -6774.910227621532 + 0.0im]
Residues: ComplexF64[2.6792602830979095e9 + 0.0im 1.0717041132461851e10 + 0.0im; 1.0717041132424355e10 + 0.0im 2.6792602830979095e9 + 0.0im;;; -1.6551610150291655e10 + 0.0im -6.6206440601639626e10 + 0.0im; -6.620644060138717e10 + 0.0im -1.6551610150291655e10 + 0.0im;;; 4.241942317337665e10 + 0.0im 1.6967769269484216e11 + 0.0im; 1.6967769269412943e11 + 0.0im 4.241942317337665e10 + 0.0im;;; -5.353206936770874e10 + 0.0im -2.1412827747274033e11 + 0.0im; -2.1412827747172232e11 + 0.0im -5.353206936770874e10 + 0.0im;;; 2.2527186601576572e10 + 0.0im 9.010874640736554e10 + 0.0im; 9.010874640679639e10 + 0.0im 2.2527186601576572e10 + 0.0im;;; 2.4717002984422768e10 + 0.0im 9.886801193841866e10 + 0.0im; 9.886801193803366e10 + 0.0im 2.4717002984422768e10 + 0.0im;;; -3.178987886029754e10 + 0.0im -1.2715951544254651e11 + 0.0im; -1.271595154418193e11 + 0.0im -3.178987886029754e10 + 0.0im;;; -4.500302431620929e9 + 0.0im -1.8001209726401134e10 + 0.0im; -1.8001209726451694e10 + 0.0im -4.500302431620929e9 + 0.0im;;; 2.9396296730180614e10 + 0.0im 1.1758518692192986e11 + 0.0im; 1.1758518692128374e11 + 0.0im 2.9396296730180614e10 + 0.0im;;; -1.275527724785865e10 + 0.0im -5.102110899221674e10 + 0.0im; -5.102110899179006e10 + 0.0im -1.275527724785865e10 + 0.0im;;; -1.7836577284244797e10 + 0.0im -7.134630913762163e10 + 0.0im; -7.134630913728137e10 + 0.0im -1.7836577284244797e10 + 0.0im;;; 2.861171487692228e10 + 0.0im 1.1444685950908478e11 + 0.0im; 1.1444685950832954e11 + 0.0im 2.861171487692228e10 + 0.0im;;; -1.9466032508811897e10 + 0.0im -7.786413003633995e10 + 0.0im; -7.78641300357427e10 + 0.0im -1.9466032508811897e10 + 0.0im;;; 7.58099891142497e9 + 0.0im 3.0323995646177166e10 + 0.0im; 3.0323995645913757e10 + 0.0im 7.58099891142497e9 + 0.0im;;; -1.6608386451879582e9 + 0.0im -6.643354580868171e9 + 0.0im; -6.643354580803363e9 + 0.0im -1.6608386451879582e9 + 0.0im;;; 1.607357462849066e8 + 0.0im 6.429429851521003e8 + 0.0im; 6.429429851451098e8 + 0.0im 1.607357462849066e8 + 0.0im]

Literature

  1. Nakatsukasa, Yuji, Olivier Sète, and Lloyd N. Trefethen. «The AAA Algorithm for Rational Approximation.» SIAM Journal on Scientific Computing 40, no. 3 (January 2018): A1494–1522. https://doi.org/10.1137/16M1106122.