Happy to join this community. Thank you in advance for your kind help! :)


I have a physical device characterized by its internal parameters, of which I know the nominal values. I also have the theoretical model of the device, that differs from the physical device because fabrication tolerances change the internal parameters.

I would like to extract the internal parameters of the device by fitting the model onto it.

The device also has additional inputs that alter its behavior. The additional inputs can be used to generate more data to fit the model. However, the device is "slow" to test, meaning it requires a few seconds to generate the data.

Physical System

The device is basically an electrical filter that alters an input spectrum in frequency $ S_{IN}(f) $ into $ S_{OUT}(f) $, and is decribed by its Transfer Function $ T(f) = \frac{S_{OUT}(f)}{S_{IN}(f)}$.

The device $T(f)$ depends on the internal parameters $k_1, k_2 ... k_N $, of which I know the nominal value, but change due to fabrication tolerances.

The behavior of the device can be altered by changing additional inputs $\phi_1, \phi_2 ... \phi_M $.

In summary, the transfer function is defined in frequency and is dependent on the fixed parameter $k$ and the controllable parameters $\phi$: $T(k_1, k_2 ... k_N, \phi_1, \phi_2 ... \phi_M)(f)$


I have a completely defined model of the device, that also models possible non-idealities of the physical system. However, while it is easy to compute the transfer function by knowing $k_{1...N}, \phi_{1...N} $, it is hard to infer the parameters by just observing $T(f)$.

Questions and discussion

What would be the best way to extract the internal parameters of the filter?

Things I tried:

  • Least Squares Fitting. This is challenging because there are a lot of internal parameters that just generate a single $T(f)$. I would need to generate multiple $T(f)$ by changing the inputs $\phi_{1...N}$, which would all be based on the same parameters $k_{1...N}$. Then, I would need somehow tell the LSF to fit all the curves at the same time, by communicating which inputs generated which $T(f)$. I ignore how to do this in SciPy.

  • Neural Networks. I have tried training a CNN that has $T(f), \phi_1, \phi_2 ... \phi_M$ as the inputs and $k_1, k_2 ... k_N $ as the outputs. Did not have much success, but does not feel smart, because I happen to know the theoretical model of the device.

  • Active Learning. This intrigued me, but it looks like it is mainly for classification problems.

I think the way to go would be to find an algorithm that tries to fit the model by playing around with the inputs and testing the device to check the quality of the fit.

Do you know something that could achieve the task?


2 Answers 2


I suggest that you implement a model of your physical device on top of an automatic differentiation package, like Tensorflow or Pytorch. This would be similar to how a neural network would be implemented, but instead of using generic computational blocks like convolutional layers, you would directly implement your transfer function.

This very same thing is done in the article Deep learning with transfer functions: new applications in system identification (code here), aiming at system identification.

If you are able to implement it with differentiable operators, then you can just fit the unknown parameters to the data from the real device.

You can also incorporate into your model stochastic elements (e.g. adding Gaussian noise to specific parts) to allow for the non-idealities of the physical system that you mentioned.

  • 1
    $\begingroup$ Thank you for the lead. I do not know yet if the specific method that you mentioned is applicable to my device, but it opened a whole set of papers on system identification and estimation that I am looking into. $\endgroup$ Commented May 20, 2022 at 17:12

If you have a physical model of which you do not know the exact parameters, then the following should work:

Generate a series of $T(f)$ functions, with repeated data points by setting $S_{in}(f)$ and measuring $S_{out}(f)$. Regardless of approach you are going to need some sort of statistic, so running a bunch of experiments is required.

As (if I understood you correctly!) you know the basic shape of $T(f)$, you could enter it as a function into python. Then, you can fit unknown parameters of this function $k_1,...k_n$ by calling scipy.optimize.curve_fit


As curve_fittakes an (k,M)-shaped array for the input, you should be able to pass the parameters $\phi_n$ as well.

  • $\begingroup$ Thank you for your suggestion! Curve_fit is a least squares fitting that has the problem I have mentioned: there are probably multiple solutions that generate the same T(f). $\endgroup$ Commented May 13, 2022 at 16:36
  • $\begingroup$ I didn't understand your suggestion on measuring the T(f) multiple times: what for? (I can measure the T(f) directly without changing multiple Sin. The measure is repeatable) $\endgroup$ Commented May 13, 2022 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.