The free equivalent of Matlab, Octave, has a tfestimate() function. By the name (never used either of tfest or tfestimate), I guess tfestimate from Octave is the similar of tfest from Matlab. In its doc page https://octave.sourceforge.io/signal/function/tfestimate.html it is mentioned the method used:
Welch (1967) periodogram/FFT method
https://en.wikipedia.org/wiki/Welch%27s_method
Matlab tfest and tfestimate are different things:
sys = tfest(tt,np) estimates the continuous-time transfer function sys with np poles, using all the input and output signals in the timetable tt.
https://ch.mathworks.com/help/ident/ref/tfest.htmltxy = tfestimate(x,y) finds a transfer function estimate between the input signal x and the output signal y evaluated at a set of frequencies.
https://ch.mathworks.com/help/signal/ref/tfestimate.htmlThe Welch method simply calculates a power spectral density estimate for a given time discrete sample vector. You use it if you have a very long input vector and would calculate a shorter FFT, like 10M samples going into a 1024 point FFT. The input vector is split in FFT size chunks (typically with 50% overlap) and the resulting FFT results are averaged. Very useful detail is that you can apply detrending methods to the chunks in oder to clean up data with slow drifts that would otherwise contaminate the spectrum with the window function spectrum. I have used this quite successfully to dig out features from very noisy mesurements.
The method cited in the initial post is tfest, which gives a continuous time transfer function in polynomial form. I did Mathworks an injustice when I claimed they would not explain how tfest works. I just missed that part in the docs:
https://ch.mathworks.com/help/ident/ref/tfest.html#btfb8zb-1This also explains why one gladly pays for their toolbox licenses: Even just reading the cited papers will cost you more (if you are paid by the hour) than the toolbox license.
tfest.py
https://github.com/giuliovv/tfest/blob/main/tfest/tfest.py looks interesting.
Why is it ok to be sweeping the frequency, rather that stopping on a bunch of steps?
I'd say with stepped sine you deal with a single, constant known frequency measurement at a time. For this it is trivially easy (quadrature demodulation) and very robust to calculate amplitude and phase. Only question I see is when set and actual stimulus frequency don't match exactly, which would be the case if signal generator and oscilloscope run from different clocks (like 100 ppm apart). In an integrated instrument (RTB2K for example) I would expect that both ADC sampling and AWG output clock are derived from the same master clock, no problem there.
With swept sine/chirp/noise inputs, the "decoding" (transfer function estimation) algorithm has to extract frequency, amplitude and phase information both from the stimulus and output vector (FFT methods as mentioned earlier), which is more sensitive to nonlinearities and dynamic range. So I guess it depends on the application. For mechanical system modal analysis, you very quickly run into nonlinearities due to assembly details or bearing preloads. For measuring the 3 dB cutoff of an opamp stage, probably anything will do. High Q circuits like the crystals mentioned earlier obviously also won't work using a fast chirp.