Did a brief read about the Hilbert Transform (HT) this Sunday, and it looks a lot like what I was heaving in mind. Now I'm not sure if I should be embarrassed for not knowing what the HT is, or proud for rediscovering the wheel.
Anyways a bummer, the fun was much bigger reinventing the wheel than learning somebody else's math.
Just kidding, I'm grateful for being pointed to the HT, thank you all for that. The math alone seems very intimidating to me, while in practice it looks trivially simple, which makes me think I still don't know what HT does, or what is it for.
As I was saying, still not sure what HT is, but assuming HT only introduces (two?) 90* phase shift(s) for each frequency present in a signal, then what I was proposing was (probably) using only the real part of the HT from the measured signal. Not sure. Also, most of the remarks, advice and example posted here are not yet in my understanding range.
Tried to get the ADC samples from the DSO into PC, to test my idea on real data. Had to dig into 100+ forks for Python-IVI drivers, and merge the relevant ones. Then it still didn't work and had to debug it with Wireshark, and so on. Still working on it, and already have communication with both the AWG and the DSO.
Meanwhile, did a more realistic simulation in LTspice. This time, emulated an AWG with a logarithmic chirp, then emulated a DSO, then plot the frequency response for two different DUT, an RC low pass, and an RLC circuit. The observed amplitude Bode plots correspond with the theoretical response of the DUT.
This one is for RC LP:
Please note that no reference chirp was sampled, and only the measured signal is used to calculate (on-the-fly) the amplitude response of the DUT (the red trace).
The chirp is done with logarithmic frequency variation, though it chirps from high to low F, to minimize any errors caused by an eventual phase noise (no noise was added into simulation for now).
The next one is for a resonant RLC:
There are some artifacts at the ends of the spectrum
- some errors at the beginning of the chirp are caused because there is no data previous to t0. These can be easily cut out
- other type of errors are caused when the frequency variation of the sweep is too fast, observed at the low frequencies end of the chirp. Same as before, the interval can be cut away, or the frequency can be swiped slower in the reference chirp, so the frequency will appear as quasi-constant along a quarter of a wavelength.
- the most amplitude wiggle seen in the red trace was because of sweeping too fast, not because of ringing