Main Content

Test, Visualize, and Enforce Passivity of Rational Output

This example shows how to test, visualize, and enforce the passivity of output from the rational function.

S-Parameter Data Passivity

Time-domain analysis and simulation depend critically on the ability to convert frequency-domain S-parameter data into causal, stable, and passive time-domain representations. Because the rational function guarantees that all poles are in the left half plane, rational output is both stable and causal by construction. The problem is passivity.

N-port S-parameter data represents a frequency-dependent transfer function H(f). You can create an S-parameters object in RF Toolbox™ by reading a Touchstone file, such as passive.s2p, into the sparameters function.

You can use the ispassive function to check the passivity of the S-parameter data, and the passivity function to plot the 2-norm of the N-by-N matrices H(f) at each data frequency.

S = sparameters("passive.s2p");
ispassive(S)
ans = logical
   1

passivity(S)

Figure contains an axes object. The axes object with title Data passive, max norm(H) is 1-4.06e-08 at 540 kHz, xlabel Frequency (GHz), ylabel norm(H) contains an object of type line.

Testing and Visualizing rational Output Passivity

The rational function converts N-port S-parameter data, S, into an object that represents a rational fit to the data. Using the ispassive function on the output reports that even if input data S is passive, the output fit is not passive. In other words, the norm H(f) is greater than 1 at some frequency in the range [0,Inf].

The passivity function takes the output of the rational function as input and plots its passivity. This is a plot of the upper bound of the norm(H(f)) on [0,Inf], also known as the H-infinity norm.

fit = rational(S);
ispassive(fit)
ans = logical
   0

passivity(fit)

Figure contains an axes object. The axes object with title Fit not passive, max norm(H) is 1+7.15e-03 at 516 MHz, xlabel Frequency (GHz), ylabel norm(H) contains 4 objects of type line. One or more of the lines displays its values using only markers

The makepassive function takes as input a rational object, and produces a passive fit by using convex optimization techniques to optimally match the data of the S-parameter input S while satisfying passivity constraints. The residues and direct term of the output pfit are modified, but the poles of the output pfit are identical to the poles of the input fit.

pfit = makepassive(fit,'Display','on');
Iter	H-infinity norm	Frequency	Error (dB)	Constraints
0		1+7.15e-03		516 MHz		-40.4597
1		1+5.32e-04		322 MHz		-41.7567	5
2		1+6.41e-05		380 MHz		-41.7311	7
3		1+6.06e-06		359 MHz		-41.7263	9
4		1-1.51e-06		359 MHz		-41.7271	10
ispassive(pfit)
ans = logical
   1

passivity(pfit)

Figure contains an axes object. The axes object with title Fit passive, max norm(H) is 1-1.51e-06 at 359 MHz, xlabel Frequency (GHz), ylabel norm(H) contains an object of type line.

all(pfit.Poles == fit.Poles)
ans = logical
   1

Generate Equivalent SPICE Circuit from Passive Fit

The generateSPICE function takes a passive fit and generates an equivalent circuit as a SPICE subcircuit file. The input fit is an object as returned by rational with an S-parameters object as input. The generated file is a SPICE model constructed solely of passive R, L, C elements and controlled source elements E, F, G, and H.

generateSPICE(pfit,'mypassive.ckt')
type mypassive.ckt
* Equivalent circuit model for mypassive.ckt
.SUBCKT mypassive po1 po2
Vsp1 po1 p1 0
Vsr1 p1 pr1 0
Rp1 pr1 0 50
Ru1 u1 0 50
Fr1 u1 0 Vsr1 -1
Fu1 u1 0 Vsp1 -1
Ry1 y1 0 1
Gy1 p1 0 y1 0 -0.02
Vsp2 po2 p2 0
Vsr2 p2 pr2 0
Rp2 pr2 0 50
Ru2 u2 0 50
Fr2 u2 0 Vsr2 -1
Fu2 u2 0 Vsp2 -1
Ry2 y2 0 1
Gy2 p2 0 y2 0 -0.02
Rx1 x1 0 1
Fxc1_2 x1 0 Vx2 1.74015617268879
Cx1 x1 xm1 4.40797252460441e-09
Vx1 xm1 0 0
Gx1_1 x1 0 u1 0 -0.0637700871526862
Rx2 x2 0 1
Fxc2_1 x2 0 Vx1 -1.10414627301351
Cx2 x2 xm2 4.40797252460441e-09
Vx2 xm2 0 0
Gx2_1 x2 0 u1 0 0.070411504059385
Rx3 x3 0 1
Cx3 x3 0 2.4654921582984e-12
Gx3_1 x3 0 u1 0 -0.857581251621603
Rx4 x4 0 1
Cx4 x4 0 1.19630315315362e-11
Gx4_1 x4 0 u1 0 -2.76926048024264
Rx5 x5 0 1
Cx5 x5 0 1.85575922925667e-11
Gx5_1 x5 0 u1 0 -1.31111108977324
Rx6 x6 0 1
Cx6 x6 0 8.71015575482792e-11
Gx6_1 x6 0 u1 0 -0.69149909318868
Rx7 x7 0 1
Cx7 x7 0 5.76402180451057e-10
Gx7_1 x7 0 u1 0 -0.0721108342718341
Rx8 x8 0 1
Cx8 x8 0 1.32870599398845e-08
Gx8_1 x8 0 u1 0 -0.853465686922301
Rx9 x9 0 1
Fxc9_10 x9 0 Vx10 1.74935603614562
Cx9 x9 xm9 4.40797252460441e-09
Vx9 xm9 0 0
Gx9_2 x9 0 u2 0 -0.0646360549264538
Rx10 x10 0 1
Fxc10_9 x10 0 Vx9 -1.09833956772413
Cx10 x10 xm10 4.40797252460441e-09
Vx10 xm10 0 0
Gx10_2 x10 0 u2 0 0.0709923366273143
Rx11 x11 0 1
Cx11 x11 0 2.4654921582984e-12
Gx11_2 x11 0 u2 0 -0.902470163715876
Rx12 x12 0 1
Cx12 x12 0 1.19630315315362e-11
Gx12_2 x12 0 u2 0 -2.78900310405917
Rx13 x13 0 1
Cx13 x13 0 1.85575922925667e-11
Gx13_2 x13 0 u2 0 -1.32128036240958
Rx14 x14 0 1
Cx14 x14 0 8.71015575482792e-11
Gx14_2 x14 0 u2 0 -0.731795467462854
Rx15 x15 0 1
Cx15 x15 0 5.76402180451057e-10
Gx15_2 x15 0 u2 0 -0.0762144344874837
Rx16 x16 0 1
Cx16 x16 0 1.32870599398845e-08
Gx16_2 x16 0 u2 0 -0.853763818333331
Gyc1_1 y1 0 x1 0 -1
Gyc1_2 y1 0 x2 0 -1
Gyc1_3 y1 0 x3 0 -1
Gyc1_4 y1 0 x4 0 0.133986062697794
Gyc1_5 y1 0 x5 0 -0.577291415705263
Gyc1_6 y1 0 x6 0 -1
Gyc1_7 y1 0 x7 0 1
Gyc1_8 y1 0 x8 0 0.998894226229646
Gyc1_9 y1 0 x9 0 0.981537021562121
Gyc1_10 y1 0 x10 0 0.985916798485002
Gyc1_11 y1 0 x11 0 0.821328915264531
Gyc1_12 y1 0 x12 0 -1
Gyc1_13 y1 0 x13 0 1
Gyc1_14 y1 0 x14 0 0.920320516766582
Gyc1_15 y1 0 x15 0 -0.916728364469166
Gyc1_16 y1 0 x16 0 -1
Gyd1_1 y1 0 u1 0 0.999569522852128
Gyd1_2 y1 0 u2 0 -0.0123921549095847
Gyc2_1 y2 0 x1 0 0.993000096686244
Gyc2_2 y2 0 x2 0 0.990919270027227
Gyc2_3 y2 0 x3 0 0.823268266139857
Gyc2_4 y2 0 x4 0 -1
Gyc2_5 y2 0 x5 0 1
Gyc2_6 y2 0 x6 0 0.974389124414883
Gyc2_7 y2 0 x7 0 -0.968871986352671
Gyc2_8 y2 0 x8 0 -1
Gyc2_9 y2 0 x9 0 -1
Gyc2_10 y2 0 x10 0 -1
Gyc2_11 y2 0 x11 0 -1
Gyc2_12 y2 0 x12 0 0.207570378859552
Gyc2_13 y2 0 x13 0 -0.668140867325716
Gyc2_14 y2 0 x14 0 -1
Gyc2_15 y2 0 x15 0 1
Gyc2_16 y2 0 x16 0 0.998655264218049
Gyd2_1 y2 0 u1 0 0.0128459656263597
Gyd2_2 y2 0 u2 0 0.999053923596191
.ENDS

See Also

Topics