# Estimate transfer function from Bode curve

I have measured the magnitude response Y_mag(f) and phase response Y_phase(f) of an unknown physical system.

Is it possible to estimate the s-domain transfer function without a priori information about the order of the polynomials in the numerator or denominator?

I am more or less looking for an out-of-the-box approach that estimates the transfer function in a sufficient way. Performance and computing time are not an issue.

Python and MATLAB (Signal Processing Toolbox, Control System Toolbox) are available.

• Matlab has a whole page on that here. Or are you interested in something else?
– Peter K.
May 19 '17 at 18:06
• @PeterK. Unfortunately, I need to get this done without System Identification Toolbox. I am not familiar with system identification theory and hence cannot reimplement all those functions on my own. Can the task also be achieve by using either Python or one of the two other MATLAB toolboxes? May 19 '17 at 18:12
• OK! My mistake. See answer regarding a possible python approach.
– Peter K.
May 19 '17 at 20:13

So this page suggests that you might be able to use this package in Python.

The main issue is that that package seems to require a time series for estimation, rather than the frequency domain data you have. To get around that, you may be able to use your frequency domain data to generate a time series.

Suppose your frequency domain data is $$Y(\omega = 2\pi f) = Y_{\tt mag}(f)\exp(\imath Y_{\tt phase}(f)), \ \ f>0$$ and the complex conjugate for $f<0$.

$$y(t) = {\tt IFFT}(Y(\omega))\\ y_{\tt padded}(t) = \left \{ \begin{array}{ll} y(t) & \mbox{for } 0 \le t \le T_y\\ 0 & \mbox{for } T_y \le t \le 2T_y \mbox{ (say)} \end{array} \right .\\ Y_{\tt padded}(\omega) = {\tt FFT}(y_{\tt padded}(t))$$ then just use this to filter a padded white noise sequence of length $T_y$ (padded to $2T_y$).

• @Monsieur.Dirac My mistake! Corrected second link.
– Peter K.
May 19 '17 at 20:41
• Thanks! Could you please comment on how to choose Ty properly? May 19 '17 at 20:48
• @Monsieur.Dirac : Use as much data as you have, so if you have $N$ data points in Y_mag and Y_phase then, after the complex conjugate for negative frequencies, you'll have $2N-1$ points in $Y$.
– Peter K.
May 19 '17 at 20:53
• Unfortunately, still no success here. Is there a way to possibly use MATLAB's tfestimate instead? May 20 '17 at 14:17
• @Monsieur.Dirac possibly! Just use the input noise and the filtered version and see what you get.
– Peter K.
May 20 '17 at 14:19