What does all this have to do with measuring ESR? Why can't we just apply a square wave of some particular frequency (probably 100 kHz) to a capacitor and measure the current, then take the ratio of applied voltage to resultant current and call that the ESR? ESR is just a resistance, right?
As I showed above, if the resistance doesn't vary with frequency, then we can use any waveshape to measure the resistance. Why wouldn't the ESR of a capacitor be constant with frequency?
Here's why:
Any impedance, at a particular frequency can be shown to be equivalent to a simple series circuit of a resistor (which is constant with frequency) and a capacitor (or inductor). But, it's also true that a simple parallel circuit consisting of a resistor in parallel with a capacitor (or inductor) can give the same impedance. Let's see how that works.
Suppose we have a 1 ohm resistor in series with a capacitive reactance of -j100 ohms. The impedance is Z = 1 - j100. What parallel combination of resistor and capacitor is equivalent to that (gives the same impedance)?
Using a calculator that can do complex arithmetic, the answer is a 10001 ohm resistor in parallel with a capacitor whose reactance is -j100.01 ohms. We can test this by using the standard product over the sum formula for parallel resistances, which also works with reactances if you use complex arithmetic.
(10001)*(-j100.01) = 0 - j1000200.01
(10001)+(-j100.01) = 10001 - j100.01
Now divide those intermediate results:
(0 - j1000200.01)/(10001 - j100.01) = 1 - j100
which is the same impedance as a 1 ohm resistor in series with a -j100 ohm reactance.
The resistor we used in the parallel combination isn't the same resistor used in the series combination.
If we connect up a series combination of a resistor and capacitor and do a sweep of the combination on the impedance analyzer, we see that the resistive part is in fact constant if the sweep is in the SERIES EQUIVALENT mode. Here's the sweep of a 10 ohm resistor in series with a 2 uF capacitor. The green curve is the impedance magnitude; the yellow curve is Rs, the equivalent series resistance (ESR):
But here's the surprising fact. If we sweep that same series combination in PARALLEL EQUIVALENT mode, look what happens. The yellow curve, which is the parallel equivalent resistance, is NOT constant with frequency!! Yet, the circuit uses a 10 ohm resistor which IS constant with frequency up to at least 1 MHz; the previous sweep shows that it is:
Why isn't the equivalent parallel resistance constant with frequency? It's because that's the way complex arithmetic works. This Application note explains it well; look at the discussion of Figure 1 and Figure 2:
http://www.low-esr.com/QT_LowESR.pdf