# Transfer function from experimental time domain data

I have two sets of time domain data. One is the input to a system and the other is its corresponding output, both measured at the same sampling frequency. How to calculate the system's transfer function from this experimental data?

• Generically this falls under system identification theory. Generally it's not easy; but you can do a lot of things. The simplest involves modeling with exponential functions. There is a standard linear algebra way to do it on raw data but some people have found it numerically unstable; when I have done it it has worked fine. But mostly on thermal work where one has to sweep details under the rug; or use FEA. The general approaches also have problems and the old <Y2000 approaches didn't work well but I think I know how to fix it. This is not a shallow subject. – rrogers May 24 '16 at 21:56

assuming your sets of time-domain data begin with $n=0$, Z transform both the input data, $x[n]$ and the output data, $y[n]$.

$$X(z) \triangleq \mathcal{Z}\{x[n]\} = \sum\limits_{n=0}^{\infty} x[n] \ z^{-n}$$ $$Y(z) \triangleq \mathcal{Z}\{y[n]\} = \sum\limits_{n=0}^{\infty} y[n] \ z^{-n}$$

divide the Z transform of the output by the Z transform of the input. the result of that division is your transfer function.

$$H(z) \triangleq \frac{Y(z)}{X(z)} = \frac{\sum\limits_{n=0}^{\infty} y[n] \ z^{-n} }{\sum\limits_{n=0}^{\infty} x[n] \ z^{-n} }$$

i cannot guarantee that, if you were to factor numerator and denominator, there will not be identical poles with zeros that could cancel and make the transfer function simpler, but it's a transfer function.

• Well the gcd algorithm is certainly available in all the CAS systems; reduce, axiom, maxim, etc... But I have never tried it in raw data. – rrogers May 24 '16 at 21:50
• @rrogers, of course the top limit of the summations has to be some finite $N$ instead of $\infty$. i dunno how the factoring alg would work. i know MATLAB has one. i think it's factor(). somehow you have to decide if a zero is close enough to a pole to treat them as equal and cancelling each other. – robert bristow-johnson May 25 '16 at 2:54
• "treat them as equal" ; unless it's mathematical based, not due to a physical accident, be very careful with that. In time domain system the mismatch typically introduces a step/offset/slope proportional to the mismatch. The digital people talk about cancelling poles with zeros but I have found it un-robust with part changes and varying environmental conditions. If you must: wrap a feedback loop that actively supports the cancellation; and still be careful because a phase distortion can still haunt you. – rrogers May 25 '16 at 15:12
• But backing up; the gcd() is a stable algorithm whereas straight factoring can be unstable. What is your input signal? Bandwidth, auto-correlation, and such. What is your physical system? Can you logically restrict the upper bandwidth of the output? Does the system load vary. Most physical systems have a varying load that needs to be accommodated. And most of all; for physical systems models are always approximations. I consider them mathematical descriptions; with all the shallowness that the word "description" implies. – rrogers May 25 '16 at 15:13