I've been using a doublet test to generate data, and then I fitted a first-order linear system with a time delay to determine the transfer function of a system. With that, I tuned a PID controller. However, turns out, in the real scenario, performing a response test like a doublet test is not an option. Now I'm looking for a way to derive the transfer function of a system solely by analysing the input and output data. The results are terrible when applying the first-order model to it ... the "optimized" transfer function is far from close to the real one. I've created a git repository with the Python script and some data to analyse... Just execute the .py file using Python 3. Necessary libraries include numpy, matplotlib and scipy :)
Now I'm considering writing a script in which I try to fit the model to a second-order, third-order, fourth, fifth-order etc. equation, and then pick the winner. However, coding this is quite a drag and has a limited chance of success. Is there maybe already a python library I can use to do this? Or does anyone have some advice, or maybe an alternative approach to this? Would be appreciated! Also with regard to different optimization software etc.