#### Phase noise/drift and the accuracy of measurements

Daniel Marks

I was going to throw this out there to see if there are any comments or ideas.

The EU1KY analyzer uses the STM32F7 discovery board with an SAI audio codec.  The audio codec provides 16 bits ADC sampling.  To get the benefit of this sampling, however, one needs to know the phase of the intermediate frequency (approximately 10 kHz) to 2^-16 radians of accuracy.   If one has a IF bandwidth say, of 50 Hz, that corresponds to 20 ms sampling time or (20 ms) X 2^-16 radians X 10 kHz = 0.03 radians or 1.7 degrees of tolerable phase drift of the intermediate frequency before the phase drift limits the accuracy of the demodulated signal rather than the bit sampling depth.

Now because one samples two signals, and one is only really interested in the difference in phase between those two signals, one should be able to use the phase drift of one to cancel the other.  If one uses the FFT to demodulate of the signal, then one may be depending on the intermediate frequency to always land in a particular frequency bin.  So if you have two signals you are trying to measure the phase difference between, you take the FFT of both of the signals, take the complex-valued amplitude and phase of each signal in the frequency bin you know where the demodulated signal is, and then multiple one signal's sample by the complex conjugate of the other, and you get the relative phase of the two.  However, if there is phase noise, the signal's FFT is split "between"  adjacent frequency bins, and does not land perfectly on the expected frequency bin, and so one does not perfectly cancel this phase noise.   The nonlinear demodulation step here is the multiplication of the two frequency samples from the two FFT's.

Another possible approach is to do this demodulation step in the time domain rather than in the frequency domain.  One can form the "complex analytic signal" versions of each of the two signals captured by the audio codec.  This is done by using the Hilbert transform to infer the imaginary part of each signal from each real-valued signal.  In practice, this may also be done by using the FFT of a real-valued signal.  The real-valued signal has a FFT that is Hermitian conjugate, that is, the negative frequencies are the complex conjugate of the positive frequencies.  If you take the FFT of a signal, zero out the negative frequencies, and take the inverse FFT, you get a complex signal that is the complex analytic signal version of the real signal.   So the idea is to form the complex analytic signal version of each of the two signals, and in the time domain multiply the complex sample in one signal by the complex conjugate of the sample in the other signal, and then sum over all of the samples.  By doing the multiplication in the time domain rather that in the frequency domain, any phase drift between the two signals is cancelled.  One can get better noise immunity by, rather than just zeroing out negative frequencies, use a passband filter in the frequency domain only around those frequencies one knows the intermediate frequency should be in, but it is a larger bandwidth than just using one frequency bin.

I am not sure if this is already done in the EU1KY analyzer but I think that phase noise is a potential problem to obtain the highest accuracy, and there are separate crystals on the codec and the SI5351A and so some drift will occur between these.  In the analyzer I designed, I actually generate a trigger signal using a comparator from the intermediate frequency which I use to sample the ADC which eliminates that kind of phase noise, but it may be possible to eliminate it through software as well.  My design uses a comparatively low power processor without floating point and therefore is too slow to do real-time floating-point demodulation of the intermediate frequency signal.

73,
Dan
KW4TI

Yury Kuchura EU1KY

Hi Dan,

Interesting idea! I will try to model this approach in Python + numpy. But maybe not for this particular project:

This device is not a lab grade VNA. First of all it is just a good antenna analyzer used to finetune very unstable system which actual antenna is, considering that in real life it is exposed to extremely varying outside weather conditions which affect its parameters. I believe the provided precision is quite enough for such a system. Also, I don't think LO phase noise makes any significant influence while tuning real antennas, especially on short waves where the incoming signals are sometimes very strong comparing to this noise.

Let me clarify what is the math is under the hood.

Single precision floating point RFFT is used for phase and magnitude calculations. 512 samples used, with 48 kHz sampling rate, IF is 10031 Hz (bin 107), then Blackman windowing. I've found no improvements in precision when I used more samples, but the sampling and calculation time grows significantly.

Then the voltage magnitude ratio between channels is calculated as a root of the sum of powers in five bins where the most of the signal power is concentrated. Even if the IF is not exactly in the center of bin, this approach makes scalloping loss negligible. But even this is an overhead I think because I use the ratio of magtitudes for further calculations, it remains the same when both coherent signals are offset from the center. The phase difference is taken only from the central bins, modelling showed that it remains constant when frequency offsets up and down within the bin. With known magnitude ratio and phase difference, it is then easy to calculate the raw impedance of the DUT connected to the bridge. It is then easy to convert it to complex reflection coefficient for chosen Z0, and to apply OSL calibration.

73!
Yury

Daniel Marks

I was thinking about what I said, and I think it may be even simpler to do what I suggested if you use Plancherel's theorem (https://en.wikipedia.org/wiki/Plancherel_theorem).  In LaTeX code

\int\limits_{t=\infty}^{\infty}{f(t) g(t)^* dt} = \frac{1}{2\pi} \int\limits_{\omega=-\infty}^{\infty}{F(\omega) G(\omega)^* d\omega}

Therefore you can do this calculation either in the frequency or time domain.  If you do it in the time domain and average, you cancel the common noise phase.  However, you should get the exact same result in the frequency domain because this is what Plancherel's theorem says.  Therefore to implement this, perhaps you should just instead of using only one bin, use the two or three adjacent bins, and multiply together F(omega) (the frequency domain sample of the first signal bin) with G(omega)^* (the complex conjugate of the frequency domain sample of the second signal bin) and just add the results from the bins together.  You need only do this for a narrow band around the center frequency enough to encompass the spreading of frequency due to phase noise.  Because it will only involve multiplying and adding a few more samples, this should add minimal overhead.

The reason I think this may be very helpful is I noticed when looking at the IF signal with a scope, there is definitely some jitter because of the frequency synthesis method of the SI5351A.  If I tried to demodulate the signal directly using a carrier (like using the FFT) there was definitely some error there.  When I trigger the sampling using the zero crossings of the IF signal, this noise pretty much disappeared.   I think you can probably effectively do the same thing in software, and the addition in computational cost will be minimal, especially if you use the Plancherel theorem trick.

Anyways I would be happy to explain more, but using the Plancherel theorem the FFT is already performing the cross-correlation that is needed to demodulate the signal.

73,
Dan
KW4TI

On Mon, Aug 12, 2019 at 12:15 PM Yury Kuchura EU1KY <kuchura@...> wrote:
Hi Dan,

Interesting idea! I will try to model this approach in Python + numpy. But maybe not for this particular project:

This device is not a lab grade VNA. First of all it is just a good antenna analyzer used to finetune very unstable system which actual antenna is, considering that in real life it is exposed to extremely varying outside weather conditions which affect its parameters. I believe the provided precision is quite enough for such a system. Also, I don't think LO phase noise makes any significant influence while tuning real antennas, especially on short waves where the incoming signals are sometimes very strong comparing to this noise.

Let me clarify what is the math is under the hood.

Single precision floating point RFFT is used for phase and magnitude calculations. 512 samples used, with 48 kHz sampling rate, IF is 10031 Hz (bin 107), then Blackman windowing. I've found no improvements in precision when I used more samples, but the sampling and calculation time grows significantly.

Then the voltage magnitude ratio between channels is calculated as a root of the sum of powers in five bins where the most of the signal power is concentrated. Even if the IF is not exactly in the center of bin, this approach makes scalloping loss negligible. But even this is an overhead I think because I use the ratio of magtitudes for further calculations, it remains the same when both coherent signals are offset from the center. The phase difference is taken only from the central bins, modelling showed that it remains constant when frequency offsets up and down within the bin. With known magnitude ratio and phase difference, it is then easy to calculate the raw impedance of the DUT connected to the bridge. It is then easy to convert it to complex reflection coefficient for chosen Z0, and to apply OSL calibration.

73!
Yury

K9HZ

This is all correct, and I have used Plancherel’s Theorem for similar things before.  The limitation then becomes sampling rate and timing because they will limit the detection of the phase noise.  I think you proved that with your triggered example.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: Analyzer-EU1KY@groups.io [mailto:Analyzer-EU1KY@groups.io] On Behalf Of Daniel Marks
Sent: Monday, August 12, 2019 11:58 AM
To: Analyzer-EU1KY@groups.io
Subject: Re: [Analyzer-EU1KY] Phase noise/drift and the accuracy of measurements

I was thinking about what I said, and I think it may be even simpler to do what I suggested if you use Plancherel's theorem (https://en.wikipedia.org/wiki/Plancherel_theorem).  In LaTeX code

\int\limits_{t=\infty}^{\infty}{f(t) g(t)^* dt} = \frac{1}{2\pi} \int\limits_{\omega=-\infty}^{\infty}{F(\omega) G(\omega)^* d\omega}

Therefore you can do this calculation either in the frequency or time domain.  If you do it in the time domain and average, you cancel the common noise phase.  However, you should get the exact same result in the frequency domain because this is what Plancherel's theorem says.  Therefore to implement this, perhaps you should just instead of using only one bin, use the two or three adjacent bins, and multiply together F(omega) (the frequency domain sample of the first signal bin) with G(omega)^* (the complex conjugate of the frequency domain sample of the second signal bin) and just add the results from the bins together.  You need only do this for a narrow band around the center frequency enough to encompass the spreading of frequency due to phase noise.  Because it will only involve multiplying and adding a few more samples, this should add minimal overhead.

The reason I think this may be very helpful is I noticed when looking at the IF signal with a scope, there is definitely some jitter because of the frequency synthesis method of the SI5351A.  If I tried to demodulate the signal directly using a carrier (like using the FFT) there was definitely some error there.  When I trigger the sampling using the zero crossings of the IF signal, this noise pretty much disappeared.   I think you can probably effectively do the same thing in software, and the addition in computational cost will be minimal, especially if you use the Plancherel theorem trick.

Anyways I would be happy to explain more, but using the Plancherel theorem the FFT is already performing the cross-correlation that is needed to demodulate the signal.

73,

Dan

KW4TI

On Mon, Aug 12, 2019 at 12:15 PM Yury Kuchura EU1KY <kuchura@...> wrote:

Hi Dan,

Interesting idea! I will try to model this approach in Python + numpy. But maybe not for this particular project:

This device is not a lab grade VNA. First of all it is just a good antenna analyzer used to finetune very unstable system which actual antenna is, considering that in real life it is exposed to extremely varying outside weather conditions which affect its parameters. I believe the provided precision is quite enough for such a system. Also, I don't think LO phase noise makes any significant influence while tuning real antennas, especially on short waves where the incoming signals are sometimes very strong comparing to this noise.

Let me clarify what is the math is under the hood.

Single precision floating point RFFT is used for phase and magnitude calculations. 512 samples used, with 48 kHz sampling rate, IF is 10031 Hz (bin 107), then Blackman windowing. I've found no improvements in precision when I used more samples, but the sampling and calculation time grows significantly.

Then the voltage magnitude ratio between channels is calculated as a root of the sum of powers in five bins where the most of the signal power is concentrated. Even if the IF is not exactly in the center of bin, this approach makes scalloping loss negligible. But even this is an overhead I think because I use the ratio of magtitudes for further calculations, it remains the same when both coherent signals are offset from the center. The phase difference is taken only from the central bins, modelling showed that it remains constant when frequency offsets up and down within the bin. With known magnitude ratio and phase difference, it is then easy to calculate the raw impedance of the DUT connected to the bridge. It is then easy to convert it to complex reflection coefficient for chosen Z0, and to apply OSL calibration.

73!

Yury

 Virus-free. www.avg.com

Bob van Donselaar

Gentlemen,

Very interesting discussions especially this ‘sneaky peak under the hood’.

Current performance already is very good with accuracy approaching my HP 3577A, as may be appreciated from the following graph

Although improvements to an already excellent concept will always be appreciated, wouldn’t it be more efficient

and already dearly wanted by more happy users when this impedance analyser is to be expanded into a full flex network

analyser by adding a referenced generator output. This should would only require one more mixer and some switching

in the audio channels.

This said by an already happy user of this near professional instrument.

Bob.

Van: Analyzer-EU1KY@groups.io [mailto:Analyzer-EU1KY@groups.io] Namens Yury Kuchura EU1KY
Verzonden: maandag 12 augustus 2019 18:15
Aan: Analyzer-EU1KY@groups.io
Onderwerp: Re: [Analyzer-EU1KY] Phase noise/drift and the accuracy of measurements

Hi Dan,

Interesting idea! I will try to model this approach in Python + numpy. But maybe not for this particular project:

This device is not a lab grade VNA. First of all it is just a good antenna analyzer used to finetune very unstable system which actual antenna is, considering that in real life it is exposed to extremely varying outside weather conditions which affect its parameters. I believe the provided precision is quite enough for such a system. Also, I don't think LO phase noise makes any significant influence while tuning real antennas, especially on short waves where the incoming signals are sometimes very strong comparing to this noise.

Let me clarify what is the math is under the hood.

Single precision floating point RFFT is used for phase and magnitude calculations. 512 samples used, with 48 kHz sampling rate, IF is 10031 Hz (bin 107), then Blackman windowing. I've found no improvements in precision when I used more samples, but the sampling and calculation time grows significantly.

Then the voltage magnitude ratio between channels is calculated as a root of the sum of powers in five bins where the most of the signal power is concentrated. Even if the IF is not exactly in the center of bin, this approach makes scalloping loss negligible. But even this is an overhead I think because I use the ratio of magtitudes for further calculations, it remains the same when both coherent signals are offset from the center. The phase difference is taken only from the central bins, modelling showed that it remains constant when frequency offsets up and down within the bin. With known magnitude ratio and phase difference, it is then easy to calculate the raw impedance of the DUT connected to the bridge. It is then easy to convert it to complex reflection coefficient for chosen Z0, and to apply OSL calibration.

73!

Yury

 Virusvrij. www.avg.com

 1 - 5 of 5
More