---
title: "Project: a 4 GHz amplifier"
heading: Designing a GaAs FET amplifier for maximum gain, from stability check to conjugate match to stub matching networks, verified by cascading the whole design
eyebrow: S6 · Lesson 51 · Project
xp: 80
---

::: hook
This project carries one transistor through the whole design flow of lessons 32 and 9. You start from the four S-parameters of a GaAs FET at 4 GHz, the same device as Pozar's maximum-gain example. You check that it's unconditionally stable, find the source and load terminations that conjugate-match both ports at once, and design the stub-and-line networks that present those terminations to it from 50 Ω. The last test does what an engineer does before sending a layout out: it cascades the input network, the transistor and the output network into one two-port and checks that the finished amplifier gives 16.71 dB with both ports matched.
:::

::: predict
## The FET has |S₂₁| = 2.6, so 8.3 dB of gain between 50 Ω terminations. How much can the matching networks add?

- [ ] Nothing: the transistor's gain is fixed
- [ ] About 1 dB
- [x] About 8.4 dB, for 16.7 dB in all
- [ ] Without limit, by making the matches sharper

::: reveal
About 8.4 dB. Both ports of this FET are badly mismatched to 50 Ω (|S₁₁| = 0.72, |S₂₂| = 0.73), so much of the available power reflects. Conjugate matching recovers it: 6.20 dB at the input and 2.21 dB at the output, for $G_{T,\max}$ = 16.71 dB. The limit is set by K: with K = 1.195, $|S_{21}/S_{12}|(K - \sqrt{K^2 - 1})$ is 46.9.
:::
:::

::: nameit
## The design flow

1. **Stability.** Compute K, |Δ| and μ at the design frequency (and, in practice, across the band). K > 1 with |Δ| < 1 allows a simultaneous conjugate match.
2. **Terminations.** With $B_1 = 1 + |S_{11}|^2 - |S_{22}|^2 - |\Delta|^2$, $C_1 = S_{11} - \Delta S_{22}^*$ and the mirror-image $B_2$, $C_2$:

$$\Gamma_S = \frac{B_1 - \sqrt{B_1^2 - 4|C_1|^2}}{2C_1}, \qquad \Gamma_L = \frac{B_2 - \sqrt{B_2^2 - 4|C_2|^2}}{2C_2}$$

   Check that $\Gamma_\text{in} = \Gamma_S^*$ and $\Gamma_\text{out} = \Gamma_L^*$.
3. **Matching networks.** Each network is a 50 Ω open-circuited shunt stub at the 50 Ω port and a 50 Ω line to the transistor. Looking back from the transistor through a line of length d, the stub's reflection $\Gamma_P$ appears rotated: $\Gamma = \Gamma_Pe^{-2j\beta d}$. A stub across 50 Ω gives a normalized admittance 1 + jb, so $\Gamma_P$ lies on the circle $|\Gamma_P + \frac{1}{2}| = \frac{1}{2}$, which for $|\Gamma_P| = \rho$ means $\cos(\arg\Gamma_P) = -\rho$. That fixes the line length; the stub supplies $b = \tan\beta\ell$.
4. **Verification.** Convert the transistor's S-parameters to ABCD, cascade the three two-ports, convert back, and read the amplifier's $S_{21}$, $S_{11}$ and $S_{22}$.
:::

::: example
## What terminations and gain contributions does the design reach?

::: solution
1. **Stability.** K = 1.195, |Δ| = 0.488 and μ = 1.040: unconditionally stable.
2. **Terminations.**
   $$\begin{aligned} \Gamma_S &= 0.872\angle 123.4° \\ \Gamma_L &= 0.876\angle 61.0° \end{aligned}$$
3. **Gain split.** It's 6.20 dB from the input match, 8.30 dB from $|S_{21}|^2$ and 2.21 dB from the output match:
   $$6.20 + 8.30 + 2.21 = 16.71\ \text{dB}$$
   equal to $G_{T,\max}$.

**Answer:** $\Gamma_S$ = 0.872∠123.4° and $\Gamma_L$ = 0.876∠61.0°, with the gain split as 6.20 + 8.30 + 2.21 = 16.71 dB, equal to $G_{T,\max}$.
:::
:::

::: example
## What matching networks does step 3 produce?

::: solution
1. **Input network.** With the shorter line in each case, the input gets a 0.0379λ line and an open stub of 0.2936λ.
2. **Output network.** A 0.1252λ line and a 0.2927λ stub.
3. **Why the stubs are long.** Both stubs must supply an inductive susceptance, $b \approx -3.6$, so each open stub is a little longer than a quarter wave.
4. **Cascade.** Cascaded with the FET, they give |S₂₁| = 16.71 dB with |S₁₁| and |S₂₂| below 10⁻⁶ at 4 GHz.
5. **Across a band.** The match degrades, which a real design would check by repeating the cascade at each frequency with the transistor's measured S-parameters.

**Answer:** at the input, a 0.0379λ line and a 0.2936λ open stub; at the output, a 0.1252λ line and a 0.2927λ open stub.
:::
:::

::: check
kind: python

## Step 1. Write `stability(S)`, returning K, |Δ| and μ for any two-port.

```python starter
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

S = np.array([[polar(0.72, -116), polar(0.03, 57)],
              [polar(2.60, 76), polar(0.73, -54)]])

def stability(S):
    # Return (K, |Delta|, mu) for a 2x2 S-matrix.
    return 0.0, 0.0, 0.0

print(stability(S))
```

```python solution
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

S = np.array([[polar(0.72, -116), polar(0.03, 57)],
              [polar(2.60, 76), polar(0.73, -54)]])

def stability(S):
    s11, s12, s21, s22 = S[0, 0], S[0, 1], S[1, 0], S[1, 1]
    d = s11*s22 - s12*s21
    K = (1 - abs(s11)**2 - abs(s22)**2 + abs(d)**2)/(2*abs(s12*s21))
    mu = (1 - abs(s11)**2)/(abs(s22 - d*np.conj(s11)) + abs(s12*s21))
    return K, abs(d), mu

print(stability(S))
```

```python tests
K, d, mu = stability(S)
assert abs(K - 1.1948) < 1e-3, f"Pozar's FET has K = 1.195 at 4 GHz; got {K:.4f}."
assert abs(d - 0.4875) < 1e-3, f"|Δ| = 0.488; got {d:.4f}."
assert abs(mu - 1.0401) < 1e-3, f"μ = 1.040; got {mu:.4f}."
S5 = S.copy(); S5[0, 1] = S[0, 1]*5
K5, d5, mu5 = stability(S5)
assert K5 < 1 and mu5 < 1, f"With five times the feedback the FET is potentially unstable (K = 0.197, μ < 1); got K = {K5:.3f}, μ = {mu5:.3f}."
assert abs(K5 - 0.1967) < 1e-3, f"K with 5x |S12| is 0.197; got {K5:.4f}."
Ssw = np.array([[S[1, 1], S[1, 0]], [S[0, 1], S[0, 0]]])
assert abs(stability(Ssw)[0] - K) < 1e-12, "K doesn't depend on which port is called 1."
```

::: right
Right. K = 1.195 and μ = 1.040: the FET is unconditionally stable at 4 GHz, and with five times the feedback it wouldn't be.
:::
:::

::: check
kind: python

## Step 2. Write `gt_db(S, gs, gl)` and `conjugate_match(S)`.

```python starter
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

S = np.array([[polar(0.72, -116), polar(0.03, 57)],
              [polar(2.60, 76), polar(0.73, -54)]])

def gt_db(S, gs, gl):
    # Transducer gain in dB with source reflection gs and load reflection gl.
    return 0.0

def conjugate_match(S):
    # Return (gs, gl) for a simultaneous conjugate match (assume K > 1).
    return 0j, 0j

gs, gl = conjugate_match(S)
print(abs(gs), np.degrees(np.angle(gs)), abs(gl), np.degrees(np.angle(gl)), gt_db(S, gs, gl))
```

```python solution
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

S = np.array([[polar(0.72, -116), polar(0.03, 57)],
              [polar(2.60, 76), polar(0.73, -54)]])

def gt_db(S, gs, gl):
    s11, s12, s21, s22 = S[0, 0], S[0, 1], S[1, 0], S[1, 1]
    gin = s11 + s12*s21*gl/(1 - s22*gl)
    g = (1 - abs(gs)**2)/abs(1 - gin*gs)**2*abs(s21)**2*(1 - abs(gl)**2)/abs(1 - s22*gl)**2
    return 10*np.log10(g)

def conjugate_match(S):
    s11, s12, s21, s22 = S[0, 0], S[0, 1], S[1, 0], S[1, 1]
    d = s11*s22 - s12*s21
    b1 = 1 + abs(s11)**2 - abs(s22)**2 - abs(d)**2
    b2 = 1 + abs(s22)**2 - abs(s11)**2 - abs(d)**2
    c1 = s11 - d*np.conj(s22)
    c2 = s22 - d*np.conj(s11)
    gs = (b1 - np.sqrt(b1**2 - 4*abs(c1)**2))/(2*c1)
    gl = (b2 - np.sqrt(b2**2 - 4*abs(c2)**2))/(2*c2)
    return gs, gl

gs, gl = conjugate_match(S)
print(abs(gs), np.degrees(np.angle(gs)), abs(gl), np.degrees(np.angle(gl)), gt_db(S, gs, gl))
```

```python tests
import numpy as np
assert abs(gt_db(S, 0, 0) - 20*np.log10(2.6)) < 1e-9, f"With 50 Ω at both ends G_T = |S21|² = 8.30 dB; got {gt_db(S, 0, 0):.4f}."
gs, gl = conjugate_match(S)
assert abs(abs(gs) - 0.8718) < 1e-3 and abs(np.degrees(np.angle(gs)) - 123.41) < 0.1, f"Γ_S should be 0.872∠123.4°; got {abs(gs):.4f}∠{np.degrees(np.angle(gs)):.2f}°."
assert abs(abs(gl) - 0.8763) < 1e-3 and abs(np.degrees(np.angle(gl)) - 61.03) < 0.1, f"Γ_L should be 0.876∠61.0°; got {abs(gl):.4f}∠{np.degrees(np.angle(gl)):.2f}°."
s11, s12, s21, s22 = S[0, 0], S[0, 1], S[1, 0], S[1, 1]
gin = s11 + s12*s21*gl/(1 - s22*gl)
gout = s22 + s12*s21*gs/(1 - s11*gs)
assert abs(gin - np.conj(gs)) < 1e-9 and abs(gout - np.conj(gl)) < 1e-9, "At a simultaneous conjugate match Γ_in = Γ_S* and Γ_out = Γ_L*."
K = (1 - abs(s11)**2 - abs(s22)**2 + abs(s11*s22 - s12*s21)**2)/(2*abs(s12*s21))
gmax = 10*np.log10(abs(s21/s12)*(K - np.sqrt(K**2 - 1)))
assert abs(gt_db(S, gs, gl) - gmax) < 1e-9, f"The match should reach G_T,max = {gmax:.3f} dB; got {gt_db(S, gs, gl):.3f}."
assert abs(gt_db(S, gs, gl) - 16.71) < 0.01, f"G_T,max is 16.71 dB; got {gt_db(S, gs, gl):.3f}."
rng = np.random.default_rng(3)
for k in range(10):
    a, b = rng.uniform(0, 0.9, 2)*np.exp(2j*np.pi*rng.uniform(size=2))
    assert gt_db(S, a, b) <= gmax + 1e-9, "No passive termination should beat the conjugate match."
```

::: right
Right. Γ_S = 0.872∠123.4° and Γ_L = 0.876∠61.0° conjugate-match both ports at once and give 16.71 dB, more than any other passive pair of terminations.
:::
:::

::: check
kind: python

## Step 3. Write `match_network(gamma)`: the open-stub-and-line network that presents gamma to the transistor from 50 Ω.

```python starter
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

def match_network(gamma):
    # A 50 ohm open-circuited shunt stub at the 50 ohm port, then a 50 ohm line of length d to the transistor.
    # Return (d, ell) in wavelengths, both in [0, 0.5), with the shortest d, such that the transistor
    # sees the reflection coefficient gamma looking back into the network.
    return 0.0, 0.0

print(match_network(polar(0.872, 123.4)))
```

```python solution
import numpy as np

def polar(m, deg):
    return m*np.exp(1j*np.radians(deg))

def match_network(gamma):
    rho, ang = abs(gamma), np.angle(gamma)
    best = None
    for phi in (np.arccos(-rho), -np.arccos(-rho)):
        two_bd = (phi - ang) % (2*np.pi)
        d = two_bd/(4*np.pi)
        gp = rho*np.exp(1j*phi)
        b = ((1 - gp)/(1 + gp)).imag
        ell = (np.arctan(b)/(2*np.pi)) % 0.5
        if best is None or d < best[0]:
            best = (d, ell)
    return best

print(match_network(polar(0.872, 123.4)))
```

```python tests
import numpy as np
def tl(theta):
    return np.array([[np.cos(theta), 1j*50*np.sin(theta)], [1j*np.sin(theta)/50, np.cos(theta)]])
def sh(y):
    return np.array([[1, 0], [y, 1]], dtype=complex)
def seen(d, ell):
    # Reflection the transistor sees: 50 ohms in parallel with the stub, through the line d.
    zp = 1/(1/50 + 1j*np.tan(2*np.pi*ell)/50)
    t = np.tan(2*np.pi*d)
    z = 50*(zp + 1j*50*t)/(50 + 1j*zp*t)
    return (z - 50)/(z + 50)
rng = np.random.default_rng(11)
for g in [polar(0.872, 123.4), polar(0.876, 61.0)] + [r*np.exp(1j*a) for r, a in zip(rng.uniform(0.05, 0.95, 8), rng.uniform(-np.pi, np.pi, 8))]:
    d, ell = match_network(g)
    assert 0 <= d < 0.5 and 0 <= ell < 0.5, f"Keep d and ℓ in [0, 0.5); got {d:.4f}, {ell:.4f}."
    assert abs(seen(d, ell) - g) < 1e-9, f"With d = {d:.4f}λ and ℓ = {ell:.4f}λ the transistor sees {seen(d, ell):.4f}, not {g:.4f}."
    for phi in (np.arccos(-abs(g)), -np.arccos(-abs(g))):
        assert d <= ((phi - np.angle(g)) % (2*np.pi))/(4*np.pi) + 1e-12, "Choose the solution with the shorter line."
def s2a(Sm):
    s11, s12, s21, s22 = Sm[0, 0], Sm[0, 1], Sm[1, 0], Sm[1, 1]
    return np.array([[((1 + s11)*(1 - s22) + s12*s21)/(2*s21), 50*((1 + s11)*(1 + s22) - s12*s21)/(2*s21)],
                     [((1 - s11)*(1 - s22) - s12*s21)/(2*s21*50), ((1 - s11)*(1 + s22) + s12*s21)/(2*s21)]])
S = np.array([[polar(0.72, -116), polar(0.03, 57)], [polar(2.60, 76), polar(0.73, -54)]])
s11, s12, s21, s22 = S[0, 0], S[0, 1], S[1, 0], S[1, 1]
dl = s11*s22 - s12*s21
b1 = 1 + abs(s11)**2 - abs(s22)**2 - abs(dl)**2; c1 = s11 - dl*np.conj(s22)
b2 = 1 + abs(s22)**2 - abs(s11)**2 - abs(dl)**2; c2 = s22 - dl*np.conj(s11)
gs = (b1 - np.sqrt(b1**2 - 4*abs(c1)**2))/(2*c1); gl = (b2 - np.sqrt(b2**2 - 4*abs(c2)**2))/(2*c2)
ds, ls = match_network(gs); dL, lL = match_network(gl)
M = sh(1j*np.tan(2*np.pi*ls)/50) @ tl(2*np.pi*ds) @ s2a(S) @ tl(2*np.pi*dL) @ sh(1j*np.tan(2*np.pi*lL)/50)
A, B, C, D = M[0, 0], M[0, 1], M[1, 0], M[1, 1]
den = A + B/50 + C*50 + D
amp_s11 = (A + B/50 - C*50 - D)/den; amp_s21 = 2/den; amp_s22 = (-A + B/50 - C*50 + D)/den
assert abs(20*np.log10(abs(amp_s21)) - 16.71) < 0.01, f"The finished amplifier should give 16.71 dB at 4 GHz; got {20*np.log10(abs(amp_s21)):.3f} dB."
assert abs(amp_s11) < 1e-6 and abs(amp_s22) < 1e-6, f"Both ports should be matched; |S11| = {abs(amp_s11):.2e}, |S22| = {abs(amp_s22):.2e}."
```

::: right
Right. Your networks present the exact terminations, and cascaded with the FET they make a 16.71 dB amplifier matched at both ports.
:::
:::

::: explain
## Why does the project end by cascading the whole amplifier instead of trusting the separate gain terms?

::: model
Each step of the design rests on a formula, and each formula assumes the steps before it were done right: the gain split assumes the terminations are exact conjugates, and the matching networks assume they present exactly those terminations. A sign error in a line's ABCD matrix or a wrong branch of an arctangent could leave every individual number looking reasonable while the finished amplifier is mismatched. Converting everything to ABCD, multiplying the three two-ports and converting back computes what the assembled circuit would actually do, with no assumption about how its parts were designed. When that independent calculation reproduces 16.71 dB with both ports matched, the whole chain of reasoning is confirmed at once.
:::
:::

::: practice

::: check
given: a = 0.6 | 0.75; b = 0.55 | 0.7; p = 0.06 | 0.1; d = 0.3 | 0.5
answer: (1 - a^2 - b^2 + d^2)/(2*p)
tolerance: 0.5%

## K: |S₁₁| {a}, |S₂₂| {b}, |S₁₂S₂₁| {p}, |Δ| {d}?

::: misses
- [any] Rollett's formula.
:::
:::

::: check
given: s = 2.2 | 3.4; r = 0.025 | 0.05; K = 1.1 | 1.5
answer: 10*log(s/r*(K - sqrt(K^2 - 1)))
unit: dB
tolerance: 0.05

## $G_{T,\max}$: |S₂₁| {s}, |S₁₂| {r}, K {K}?

::: misses
- [any] $|S_{21}/S_{12}|(K - \sqrt{K^2 - 1})$.
:::
:::

::: check
given: r = 0.3 | 0.6 | 0.85
answer: acos(-r)*180/pi
unit: °
tolerance: 0.2

## A stub across 50 Ω produces a reflection of magnitude {r}. What angle (0 to 180°) must it have to lie on the unit-conductance circle?

::: misses
- [any] $\cos(\arg\Gamma_P) = -\rho$.
:::
:::
:::
