Network parameters
Convert a network's scattering parameters to and from its impedance, admittance, chain (ABCD) and transfer parameters, at the reference impedances of your choice. A conversion takes one matrix, or an array of matrices with the frequency along the dimensions after the first two; an in-place form, ending in !, writes into an array of the same shape.
See the API overview for other topics, closed-form networks for networks to convert, and connections to join them.
Convert and renormalize
A line of 40 Ω, 1 cm long, between 50 Ω ports, the measurement system. Its chain matrix gives its scattering parameters at 50 Ω, and its impedance matrix carries them to 40 Ω ports, where the line is matched. At 50 Ω the reflection is that of a line section between two equal media, Γ(1 - exp(-2iθ))/(1 - Γ² exp(-2iθ)) with Γ = (40 - 50)/(40 + 50) and θ its electrical length; at 6 GHz the line is half a wavelength long and reflects nothing.
using JosephsonCircuits
w = 2pi .* [4e9, 5e9, 6e9]
len, vp = 0.01, 1.2e8
θ = w .* len ./ vp
# one chain matrix per frequency, 2×2×3
abcd = JosephsonCircuits.ABCD_tline(40.0, θ)
S = JosephsonCircuits.ABCDtoS(abcd; portimpedances = 50.0)
Z = JosephsonCircuits.StoZ(S; portimpedances = 50.0)
S40 = JosephsonCircuits.ZtoS(Z; portimpedances = 40.0)
Γ = (40 - 50)/(40 + 50)
closed = Γ .* (1 .- exp.(-2im .* θ)) ./ (1 .- Γ^2 .* exp.(-2im .* θ))
@assert isapprox(S[1, 1, :], closed; atol = 1e-12)
@assert maximum(abs, S40[1, 1, :]) < 1e-12
(S11 = S[1, 1, :], closed = closed, S11at40 = S40[1, 1, :])(S11 = ComplexF64[-0.16664157760048176 + 0.09386396066909475im, -0.056935658077457256 + 0.09621019761221972im, -3.45882099876391e-33 + 2.7554552980815448e-17im], closed = ComplexF64[-0.16664157760048165 + 0.09386396066909468im, -0.05693565807745726 + 0.09621019761221974im, -8.43614877747295e-35 + 2.7554552980815445e-17im], S11at40 = ComplexF64[3.81140974547136e-16 - 1.0902954179146984e-16im, -3.290813860454552e-16 - 3.181927392442096e-16im, 3.276858658674052e-16 + 9.487917790209044e-17im])A complex reference impedance defines pseudo-waves; see ZtoS.
JosephsonCircuits.ABCDtoS Function
ABCDtoS(ABCD;portimpedances=50.0)Convert the 2 port chain (ABCD) matrix ABCD to the scattering parameter matrix S and return the result. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument: a number for both ports, a vector of one or two impedances, the first for the input port and the last for the output port, or a matrix of such columns, one per frequency. The waves are the pseudo-waves of ZtoS, with the square root of each port impedance.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.ABCDtoS! Method
ABCDtoS!(ABCD::AbstractMatrix, portimpedances)See ABCDtoS for description.
JosephsonCircuits.AtoB Function
AtoB(A)Convert the chain (ABCD) matrix A to the inverse chain matrix B and return the result. Note that despite the name, the inverse of the chain matrix is not equal to the inverse chain matrix, inv(A) ≠ B.
Examples
julia> A = Complex{Float64}[1.0 0.0;1/50 1.0];JosephsonCircuits.AtoB(A)
2×2 Matrix{ComplexF64}:
1.0+0.0im 0.0+0.0im
0.02+0.0im 1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.AtoB! Method
AtoB!(B::AbstractMatrix,A::AbstractMatrix,tmp::AbstractMatrix)See AtoB for description.
JosephsonCircuits.AtoS Function
AtoS(A; portimpedances = 50.0)Convert the chain (ABCD) matrix A to the scattering parameter matrix S and return the result. The first half of the ports are the inputs of the chain matrix and the second half its outputs, each with its own port impedances: portimpedances is a scalar, a vector with one value per port, or a matrix with one row per port and one column per frequency, 50 Ohms unless specified. A is the chain matrix of StoA, [V1; I1] = A*[V2; -I2] with the currents into the ports.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.AtoS! Method
AtoS!(S::AbstractMatrix, A::AbstractMatrix, tmp::AbstractMatrix,
sqrtportimpedances1, sqrtportimpedances2)See AtoS for description.
JosephsonCircuits.AtoY Function
AtoY(A)Convert the chain (ABCD) matrix A to the admittance matrix Y and return the result.
Examples
julia> A = Complex{Float64}[-1 -50.0;0 -1];JosephsonCircuits.AtoY(A)
2×2 Matrix{ComplexF64}:
0.02+0.0im 0.02+0.0im
0.02+0.0im 0.02+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.AtoY! Method
AtoY!(Y::AbstractMatrix,A::AbstractMatrix,tmp::AbstractMatrix)See AtoY for description.
JosephsonCircuits.AtoZ Function
AtoZ(A)Convert the ABCD matrix A to the impedance matrix Z and return the result.
Examples
julia> A = Complex{Float64}[1.0 0.0;1/50 1.0];JosephsonCircuits.AtoZ(A)
2×2 Matrix{ComplexF64}:
50.0+0.0im 50.0+0.0im
50.0+0.0im 50.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.AtoZ! Method
AtoZ!(Z::AbstractMatrix,A::AbstractMatrix,tmp::AbstractMatrix)See AtoZ for description.
JosephsonCircuits.BtoA Function
BtoA(B)Convert the inverse chain matrix B to the chain (ABCD) matrix A and return the result. Note that despite the name, the inverse of the chain matrix is not equal to the inverse chain matrix, inv(A) ≠ B.
Examples
julia> B = Complex{Float64}[1.0 0.0;1/50 1.0];JosephsonCircuits.BtoA(B)
2×2 Matrix{ComplexF64}:
1.0+0.0im 0.0+0.0im
0.02+0.0im 1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.BtoA! Method
BtoA!(A::AbstractMatrix,B::AbstractMatrix,tmp::AbstractMatrix)See BtoA for description.
JosephsonCircuits.BtoS Function
BtoS(B; portimpedances = 50.0)Convert the inverse chain (ABCD) matrix B to the scattering parameter matrix S and return the result. The first half of the ports are the inputs of the chain matrix and the second half its outputs, each with its own port impedances: portimpedances is a scalar, a vector with one value per port, or a matrix with one row per port and one column per frequency, 50 Ohms unless specified.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006 with change of overall sign (suspected typo).
sourceJosephsonCircuits.BtoS! Method
BtoS!(S::AbstractMatrix, B::AbstractMatrix, tmp::AbstractMatrix,
sqrtportimpedances1, sqrtportimpedances2)See BtoS for description.
JosephsonCircuits.BtoY Function
BtoY(B)Convert the inverse chain matrix B to the admittance matrix Y and return the result.
Examples
julia> B = Complex{Float64}[-1 -50.0;0 -1];JosephsonCircuits.BtoY(B)
2×2 Matrix{ComplexF64}:
0.02+0.0im 0.02+0.0im
0.02+0.0im 0.02+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.BtoY! Method
BtoY!(Y::AbstractMatrix,B::AbstractMatrix,tmp::AbstractMatrix)See BtoY for description.
JosephsonCircuits.BtoZ Function
BtoZ(B)Convert the inverse chain matrix B to the impedance matrix Z and return the result.
Examples
julia> B = Complex{Float64}[1.0 0.0;1/50 1];JosephsonCircuits.BtoZ(B)
2×2 Matrix{ComplexF64}:
50.0+0.0im 50.0+0.0im
50.0+0.0im 50.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006 with change of sign on B21 and B22 terms (suspected typo).
sourceJosephsonCircuits.BtoZ! Method
BtoZ!(Z::AbstractMatrix,B::AbstractMatrix,tmp::AbstractMatrix)See BtoZ for description.
JosephsonCircuits.StoA Function
StoA(S; portimpedances = 50.0)Convert the scattering parameter matrix S to the chain (ABCD) matrix A and return the result. The first half of the ports are the inputs of the chain matrix and the second half its outputs, each with its own port impedances: portimpedances is a scalar, a vector with one value per port, or a matrix with one row per port and one column per frequency, 50 Ohms unless specified. With the voltages V and the currents I into the ports, [V1; I1] = A*[V2; -I2]: the output currents are taken flowing out of the output ports, so that the chain matrix of networks in cascade is the product of theirs.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoA! Method
StoA!(A::AbstractMatrix, S::AbstractMatrix, tmp::AbstractMatrix,
sqrtportimpedances1, sqrtportimpedances2)See StoA for description.
JosephsonCircuits.StoABCD Function
StoABCD(S;portimpedances=50.0)Convert the scattering parameter matrix S to the 2 port chain (ABCD) matrix and return the result. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument, one impedance for both ports or one for each, as for ABCDtoS. A two port which transmits nothing, S[2,1] == 0, has no chain matrix, and a SingularException is thrown.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoABCD! Method
StoABCD!(S::AbstractMatrix, portimpedances)See StoABCD for description.
JosephsonCircuits.StoB Function
StoB(S; portimpedances = 50.0)Convert the scattering parameter matrix S to the inverse chain (ABCD) matrix B and return the result. Note that despite the name, the inverse of the chain matrix is not equal to the inverse chain matrix, inv(A) ≠ B: with the currents into the ports, [V2; I2] = B*[V1; -I1], the chain matrix of the network seen from its outputs. The first half of the ports are the inputs of the chain matrix and the second half its outputs, each with its own port impedances: portimpedances is a scalar, a vector with one value per port, or a matrix with one row per port and one column per frequency, 50 Ohms unless specified.
References
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoB! Method
StoB!(B::AbstractMatrix, S::AbstractMatrix, tmp::AbstractMatrix,
sqrtportimpedances1, sqrtportimpedances2)See StoB for description.
JosephsonCircuits.StoT Function
StoT(S)Convert the scattering parameter matrix S to a transmission matrix T and return the result. The first half of the ports are the inputs and the second half the outputs, and T relates the waves at the inputs to those at the outputs, [b1; a1] = T*[a2; b2], so that the transmission matrix of networks in cascade, the outputs of each joined to the inputs of the next, is the product of theirs, T1*T2.
Examples
julia> S = Complex{Float64}[0.0 1.0;1.0 0.0];JosephsonCircuits.StoT(S)
2×2 Matrix{ComplexF64}:
1.0+0.0im -0.0+0.0im
0.0-0.0im 1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoT! Method
StoT!(T::AbstractMatrix,S::AbstractMatrix,tmp::AbstractMatrix)See StoT for description.
JosephsonCircuits.StoY Function
StoY(S;portimpedances=50.0)Convert the scattering parameter matrix S to an admittance parameter matrix Y and return the result. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument, a scalar, vector, or matrix of port impedances. A complex port impedance defines pseudo-waves, as described in ZtoS.
Examples
julia> S = Complex{Float64}[0.0 0.999;0.999 0.0];JosephsonCircuits.StoY(S)
2×2 Matrix{ComplexF64}:
19.99+0.0im -19.99+0.0im
-19.99+0.0im 19.99+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoY! Method
StoY!(Y::AbstractMatrix,S::AbstractMatrix,tmp::AbstractMatrix,oneoversqrtportimpedances)In place version of StoY, writing into Y with tmp as scratch and oneoversqrtportimpedances the reciprocal square roots of the port impedances.
JosephsonCircuits.StoZ Function
StoZ(S;portimpedances=50.0)Convert the scattering parameter matrix S to an impedance parameter matrix Z and return the result. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument, a scalar, vector, or matrix of port impedances. A complex port impedance defines pseudo-waves, as described in ZtoS.
Examples
julia> S = Complex{Float64}[0.0 0.0;0.0 0.0];JosephsonCircuits.StoZ(S)
2×2 Matrix{ComplexF64}:
50.0+0.0im 0.0+0.0im
0.0+0.0im 50.0+0.0im
julia> S = Complex{Float64}[0.0 0.999;0.999 0.0];JosephsonCircuits.StoZ(S)
2×2 Matrix{ComplexF64}:
49975.0+0.0im 49975.0+0.0im
49975.0+0.0im 49975.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.StoZ! Method
StoZ!(Z::AbstractMatrix,S::AbstractMatrix,tmp::AbstractMatrix,sqrtportimpedances)See StoZ for description.
JosephsonCircuits.TtoS Function
TtoS(T)Convert the transmission matrix T to a scattering parameter matrix S and return the result; the inverse of StoT, which gives the convention.
Examples
julia> T = Complex{Float64}[1.0 0.0;0.0 1.0];JosephsonCircuits.TtoS(T)
2×2 Matrix{ComplexF64}:
0.0-0.0im 1.0+0.0im
1.0+0.0im 0.0-0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006 with change of sign on T11 and T21 terms (suspected typo).
sourceJosephsonCircuits.TtoS! Method
TtoS!(S::AbstractMatrix,T::AbstractMatrix,tmp::AbstractMatrix)See TtoS for description.
JosephsonCircuits.YtoA Function
YtoA(Y)Convert the admittance matrix Y to the chain (ABCD) matrix A and return the result.
Examples
julia> Y = Complex{Float64}[1/50 1/50;1/50 1/50];JosephsonCircuits.YtoA(Y)
2×2 Matrix{ComplexF64}:
-1.0+0.0im -50.0+0.0im
0.0+0.0im -1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006, with the overall sign changed (a suspected typo there).
sourceJosephsonCircuits.YtoA! Method
YtoA!(A::AbstractMatrix,Y::AbstractMatrix,tmp::AbstractMatrix)See YtoA for description.
JosephsonCircuits.YtoB Function
YtoB(Y)Convert the admittance matrix Y to the inverse chain matrix B and return the result.
Examples
julia> Y = Complex{Float64}[1/50 1/50;1/50 1/50];JosephsonCircuits.YtoB(Y)
2×2 Matrix{ComplexF64}:
-1.0+0.0im -50.0+0.0im
0.0+0.0im -1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.YtoB! Method
YtoB!(B::AbstractMatrix,Y::AbstractMatrix,tmp::AbstractMatrix)See YtoB for description.
JosephsonCircuits.YtoS Function
YtoS(Y;portimpedances=50.0)Convert the admittance parameter matrix Y to a scattering parameter matrix S and return the result. portimpedances is a scalar, vector, or matrix of port impedances. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument.
Examples
julia> Y = Complex{Float64}[1/50.0 0.0;0.0 1/50.0];JosephsonCircuits.YtoS(Y)
2×2 Matrix{ComplexF64}:
0.0+0.0im 0.0-0.0im
0.0-0.0im 0.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.YtoS! Method
YtoS!(S::AbstractMatrix,Y::AbstractMatrix,tmp::AbstractMatrix,sqrtportimpedances)See YtoS for description.
JosephsonCircuits.YtoZ Function
YtoZ(Y)Convert the admittance matrix Y to the impedance matrix Z, its inverse, and return the result.
JosephsonCircuits.ZtoA Function
ZtoA(Z)Convert the impedance matrix Z to the ABCD matrix A and return the result.
Examples
julia> Z = Complex{Float64}[50.0 50.0;50.0 50.0];JosephsonCircuits.ZtoA(Z)
2×2 Matrix{ComplexF64}:
1.0+0.0im 0.0-0.0im
0.02+0.0im 1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.ZtoA! Method
ZtoA!(A::AbstractMatrix,Z::AbstractMatrix,tmp::AbstractMatrix)See ZtoA for description.
JosephsonCircuits.ZtoB Function
ZtoB(Z)Convert the impedance matrix Z to the inverse chain matrix B and return the result.
Examples
julia> Z = Complex{Float64}[50.0 50;50 50];JosephsonCircuits.ZtoB(Z)
2×2 Matrix{ComplexF64}:
1.0+0.0im 0.0-0.0im
0.02+0.0im 1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.ZtoB! Method
ZtoB!(B::AbstractMatrix,Z::AbstractMatrix,tmp::AbstractMatrix)See ZtoB for description.
JosephsonCircuits.ZtoS Function
ZtoS(Z;portimpedances=50.0)Convert the impedance parameter matrix Z to a scattering parameter matrix S and return the result. portimpedances is a scalar, vector, or matrix of port impedances. Assumes a port impedance of 50 Ohms unless specified with the portimpedances keyword argument. A complex port impedance Z_k defines the pseudo-waves a_k = (V_k + Z_k I_k)/(2 sqrt(Z_k)) and b_k = (V_k - Z_k I_k)/(2 sqrt(Z_k)), which a load of impedance Z_k matches, rather than power waves.
Examples
julia> Z = Complex{Float64}[0.0 0.0;0.0 0.0];JosephsonCircuits.ZtoS(Z)
2×2 Matrix{ComplexF64}:
-1.0+0.0im 0.0+0.0im
0.0+0.0im -1.0+0.0imReferences
Russer, Peter. Electromagnetics, Microwave Circuit, And Antenna Design for Communications Engineering, Second Edition. Artech House, 2006.
sourceJosephsonCircuits.ZtoS! Method
ZtoS!(S::AbstractMatrix,Z::AbstractMatrix,tmp::AbstractMatrix,oneoversqrtportimpedances)In place version of ZtoS, writing into S with tmp as scratch and oneoversqrtportimpedances the reciprocal square roots of the port impedances.
JosephsonCircuits.ZtoY Function
ZtoY(Z)Convert the impedance matrix Z to the admittance matrix Y, its inverse, and return the result.