# Measure input/output impedance with Spice

Started by October 14, 2012
```Could some electronics/Spice guru shed some
light on this. Suppose I want to measure the
input impedance of a test circuit. The impedance
can be AC or DC. Let us consider DC.

I set up the following circuit, with a DC
voltage source, connected with a voltage
source with zero DC and AC output, followed
by the circuit under test. I sweep the DC
voltage of the first DC voltage source. and
the input impedance is:

Zin = 1/(Iin(dI/dV)) where Iin is the
instantaneous current indicated by the
zero output voltage source, and dI and
dV are measured. Is this a sound scheme ?
All hints/suggestions would be of immense
help.
```
```On a DC sweep, any plot of voltage vs. current has coordinates in ohms (or
reciprocal in mhos).

There are two kinds of resistance to note: static (DC) resistance, and
incremental (dynamic, differential) resistance.  Static is when you take
the coordinates of a point on a curve, and divide.  Incremental is the
slope of the curve at that point.

All linear resistor networks have static = incremental.

Note that if the resistance is measured with respect to different parts of
the circuit, it's more properly transresistance (e.g., an amplifier with
voltage output and current input has a gain of Vo / Iin, a resistance).

For general purpose, you probably want the AC impedance, not the DC
impedance.  Use an AC analysis for this.  You can find the impedance from
the current drawn from an AC voltage source applied to the port in
question (setting all other sources to 0V AC).

For example, here's a grounded emitter, class A, tuned amplifier:
http://t3sl4.dnsdynamic.net/Images/ResonantStage2.png
(Ignore T1.)
The S parameters measured are:
http://t3sl4.dnsdynamic.net/Images/ResonantStage1.png

Return loss (gamma) is a matching parameter.  When:
gamma = -1: Load is open circuit (infinite resistance)
-1 < gamma < 0: Impedance is higher than source impedance (R4 = 100 ohm)
gamma = 0: Impedance equals source
0 < gamma < 1: Impedance is lesser than source
gamma = 1: Load is a short circuit (0 ohms)
gamma > 1: Load is negative!

Note that this circuit actually has a negative input impedance from about
380k to 500k.  This type of circuit can oscillate very easily, and
precautions have to be taken to ensure the input isn't overly reactive.

I could've just as well plotted input impedance in the graphs, using the
same parameters, and the AC definition of input impedance.

Hmm, this graph is showing gamma as low as -4.  Might've got the formula
wrong...

Tim

--
Deep Friar: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms

<dakupoto@gmail.com> wrote in message
> Could some electronics/Spice guru shed some
> light on this. Suppose I want to measure the
> input impedance of a test circuit. The impedance
> can be AC or DC. Let us consider DC.
>
> I set up the following circuit, with a DC
> voltage source, connected with a voltage
> source with zero DC and AC output, followed
> by the circuit under test. I sweep the DC
> voltage of the first DC voltage source. and
> the input impedance is:
>
> Zin = 1/(Iin(dI/dV)) where Iin is the
> instantaneous current indicated by the
> zero output voltage source, and dI and
> dV are measured. Is this a sound scheme ?
> All hints/suggestions would be of immense
> help.

```
```----- Original Message -----
From: <dakupoto@gmail.com>
Newsgroups: sci.electronics.design
Sent: Sunday, October 14, 2012 8:05 AM
Subject: Measure input/output impedance with Spice

> Could some electronics/Spice guru shed some
> light on this. Suppose I want to measure the
> input impedance of a test circuit. The impedance
> can be AC or DC. Let us consider DC.
>
> I set up the following circuit, with a DC
> voltage source, connected with a voltage
> source with zero DC and AC output, followed
> by the circuit under test. I sweep the DC
> voltage of the first DC voltage source. and
> the input impedance is:
>
> Zin = 1/(Iin(dI/dV)) where Iin is the
> instantaneous current indicated by the
> zero output voltage source, and dI and
> dV are measured. Is this a sound scheme ?
> All hints/suggestions would be of immense
> help.

Hello,

You can get the impedance using the .TF analysis for DC while stepping your
DC-source.
.step V1 -1 1 0.1
.TF ....

It's also possible to use the AC-analysis while stepping your DC-source.
This greatly works with LTspice.
Then plot V(...)/I(...).

.step V1 -1 1 0.1
.AC list 1

All the instructions above are for LTspice.
Other SPICE programs may have a different syntax for ".step" or eventually
don't have this feature.

Best regards,
Helmut

```
```On Sat, 13 Oct 2012 23:05:00 -0700 (PDT), dakupoto@gmail.com wrote:

>Could some electronics/Spice guru shed some
>light on this. Suppose I want to measure the
>input impedance of a test circuit. The impedance
>can be AC or DC. Let us consider DC.
>
>I set up the following circuit, with a DC
>voltage source, connected with a voltage
>source with zero DC and AC output, followed
>by the circuit under test. I sweep the DC
>voltage of the first DC voltage source. and
>the input impedance is:
>
>Zin = 1/(Iin(dI/dV)) where Iin is the
>instantaneous current indicated by the
>zero output voltage source, and dI and
>dV are measured. Is this a sound scheme ?
>All hints/suggestions would be of immense
>help.

For DC I'd sweep the input with a CURRENT source, the DC "impedance"
is simply the voltage.  For incremental, just take the
derivative/slope.

For AC, with a DC bias, you'll have to do a .AC with a VAC source,
then do some complex (A + jB) math to get impedance, real and
imaginary parts.

In PSpice the DC part is handled by sweeping parameter.

Over the years I have made macros which, from a .AC/VAC analysis, spit
out Cin, and its serial resistance, to easily obtain CMOS OpAmp input
characteristics.

...Jim Thompson
--
| James E.Thompson, CTO                            |    mens     |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |

I love to cook with wine.     Sometimes I even put it in the food.
```
```On Sat, 13 Oct 2012 23:05:00 -0700, dakupoto wrote:

> Could some electronics/Spice guru shed some light on this. Suppose I want
> to measure the input impedance of a test circuit. The impedance can be AC
> or DC. Let us consider DC.

In the case of DC, just do some plot math, or a .meas directive (RTFM), on
the appropriate node.

In the AC case, add a .net directive (RTFM again), then do a normal .ac
analysis. Under " visible traces", you'll find that you now get offered
Zin, Zout, Yin, Yout, and all S parameters.

/examples/Educational/S-param.asc explains this quite well.

--
"For a successful technology, reality must take precedence
over public relations, for nature cannot be fooled."
(Richard Feynman)
```
```On Sunday, October 14, 2012 8:05:00 AM UTC+2, daku...@gmail.com wrote:
> Could some electronics/Spice guru shed some=20
>=20
> light on this. Suppose I want to measure the=20
>=20
> input impedance of a test circuit. The impedance=20
>=20
> can be AC or DC. Let us consider DC.
>=20
>=20
>=20
> I set up the following circuit, with a DC=20
>=20
> voltage source, connected with a voltage=20
>=20
> source with zero DC and AC output, followed=20
>=20
> by the circuit under test. I sweep the DC=20
>=20
> voltage of the first DC voltage source. and=20
>=20
> the input impedance is:
>=20
>=20
>=20
> Zin =3D 1/(Iin(dI/dV)) where Iin is the=20
>=20
> instantaneous current indicated by the=20
>=20
> zero output voltage source, and dI and=20
>=20
> dV are measured. Is this a sound scheme ?=20
>=20
> All hints/suggestions would be of immense=20
>=20
> help.

Use LTSpice.
Using the .net command. Works for AC.
Right click on plot window , select trace. Take your pic. Zin , Zout , S11 =
etc

Version 4
SHEET 1 880 680
WIRE 112 160 48 160
WIRE 240 160 192 160
WIRE 304 160 240 160
WIRE 416 160 368 160
WIRE 448 160 416 160
WIRE 544 160 528 160
WIRE 544 192 544 160
WIRE 240 208 240 160
WIRE 416 224 416 160
WIRE 48 304 48 240
WIRE 240 304 240 288
WIRE 240 304 48 304
WIRE 304 304 240 304
WIRE 416 304 416 288
WIRE 416 304 304 304
WIRE 544 304 544 272
WIRE 544 304 416 304
FLAG 304 304 0
SYMBOL res 208 144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 10
SYMBOL res 256 304 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R2
SYMATTR Value 75
SYMBOL cap 368 144 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 33p
SYMBOL cap 432 288 R180
WINDOW 0 24 56 Left 2
WINDOW 3 24 8 Left 2
SYMATTR InstName C2
SYMATTR Value 22p
SYMBOL ind 544 144 R90
WINDOW 0 5 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName L1
SYMATTR Value 10=B5
SYMBOL res 528 176 R0
SYMATTR InstName R3
SYMATTR Value 100
SYMATTR SpiceLine ""
SYMBOL voltage 48 144 R0
WINDOW 123 24 124 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value2 AC 1
SYMATTR SpiceLine ""
TEXT 48 96 Left 2 !.ac dec 1000 10 100meg
TEXT 48 72 Left 2 !.net I(R3) V1

```
```On Thu, 08 Nov 2012 03:12:59 -0800, robindavis001 wrote:

> Use LTSpice.
> Using the .net command. Works for AC.
> Right click on plot window , select trace. Take your pic. Zin , Zout , S11 etc

What I said.

--
"For a successful technology, reality must take precedence
over public relations, for nature cannot be fooled."
(Richard Feynman)
```