## Calculating derivatives

While preparing a workshop about measurement uncertainty the other day, I decided to look for discussion topics in an Application Note about an instrument designed for high frequency measurements (at radio and microwave frequencies) .

I found a section where the authors made a reasonable sounding decision, choosing between two alternative circuit configurations, one called a power splitter the other called a power divider.

I decided to check their assumptions, which eventually led me to calculate some partial derivatives with GTC.

#### The splitter and divider networks

The power splitter has two resistors, each of impedance $$Z_0$$.

As this diagram shows, there are three "ports" (pairs of lines). The input port is on the left and the two output ports are on the right.

The power divider has three resistors, each of impedance $$\frac{Z_0}{3}$$.

There are also three ports. The input is shown here on the left and the two outputs are on the right.

#### Ideal behaviour and sensitivity to errors

Now, when these networks are connected to an "ideal" circuit, the two lines of each output port are effectively connected together by an impedance of $$Z_0$$. In that case, the impedance at the input port can be calculated and is equal $$Z_0$$ too.

That is an ideal configuration, and both the power splitter and power divider behave the same way.

However, the Application Note claimed that if the terminating impedance at an output port was slightly different from $$Z_0$$, the resulting change of impedance seen at the input port would be smaller for a splitter than for a divider.

In other words, the power splitter would be less sensitive to variation of the impedance at the output ports.

This seems reasonable, because the impedances in the splitter are three times bigger of those in the divider. However, I decided to check.

#### Checking the assumption

We need equations for the input impedance $$Z_\mathrm{in}$$, which will depend on $$Z_0$$ and the non-ideal impedance at one port $$Z$$.

For the power splitter, the equation is1
$Z_\mathrm{in} = \frac{2 Z_0 (Z_0 + Z)}{3Z_0 + Z}$
and for the power divider, it is
$Z_\mathrm{in} = \frac{Z_0}{3} + \frac{\frac{4 Z_0}{3}(\frac{Z_0}{3} + Z)}{\frac{4 Z_0}{3} + \frac{Z_0}{3} + Z}$
To find the sensitivity of $$Z_\mathrm{in}$$ to changes, these equations must be differentiated with respect to $$Z$$.

GTC can do these calculations quite easily (I'm a bit out of practice with differentiation).

The following code differentiates the equations above. It first prints out the value of $$Z_\mathrm{in}$$, which we expect to be equal to $$Z_0 = 50$$ in this case. Then the function rp.sensitivity() obtains the first partial derivative of $$Z_\mathrm{in}$$ with respect to $$Z$$.

It is worth noting, that when Z is defined as an uncertain number, in line 14, the uncertainty argument is set to unity, although any number could have been used except for zero. A value of zero would have fooled GTC into thinking that Z was a constant, so rp.sensitivity() would have returned a value of zero.

"""
Compare the sensitivity of the input impedance to departures from Z0.

The Application Note, claims that the 2-resistor splitter is less
sensitive at the input port to changes in the output port impedance.
It isn't!!!

"""
Z0 = 50
Z0_3 = Z0/3.0

# This is the impedance of the output port.
# The second parameter can be anything other than zero.
Z = ureal(Z0,1)

# Splitter expression for input impedance
Z_in = 2*Z0*(Z + Z0)/(Z + 3*Z0)

#
print value(Z_in)
print "sensitivity of Z_in to Z = %G" % rp.sensitivity(Z_in,Z)
print

# Divider expression for input impedance
num = 4*Z0_3 * (Z0_3 + Z)
den = 4*Z0_3 + (Z0_3 + Z)
Z_in = Z0_3 + num/den

print value(Z_in)
print "sensitivity of Z_in to Z = %G" % rp.sensitivity(Z_in,Z)

#### And the results are ...

Input impedance Z0 = 50
sensitivity of Z_in to Z = 0.25

Input impedance Z0 = 50
sensitivity of Z_in to Z = 0.25

In both cases, the value of derivative of $$Z_\mathrm{in}$$ with respect to $$Z$$ is $$\frac{1}{4}$$.

So the Application Note was wrong!

It does not matter whether you use a divider or a splitter, the effect of an imperfect termination at the output ports is the same.

I felt obliged to check this result by hand before posting, but it was certainly a lot harder to remember the calculus rules than to write a little GTC script like the one above.

[1] These equations can be obtained fairly easily if you know the rules for combining series and parallel impedances. Just remember to connect another $$Z_0$$ impedance across the output port terminals.