# get poles and zeros of frequency response

I am working on a python based LTSPICE project.

I would like to get poles and zeros of AC simulation data. Is there a way to get them under use of the magnitude and phase out of the frequency response of my system?

• What have you done so far? – Filipe Pinto Nov 11 '19 at 15:42
• I have a automation that calculates stability under use of the minor loop gain criterion and now I would like to check if I could already implement the fulfilment of the passivity criterion which has two conditions: 1: Is the phase in the area between +-90° respectively the amplitude always positive and 2: Do the tf poles all lie in the LHP (left half plane) so I therefore need the pole positions – Andre Nov 11 '19 at 16:22
• The frequency response data (f and the route in dB and phase in degree) are stored in a pandas dataframe. – Andre Nov 11 '19 at 16:26
• Would the answers to this question be helpful? – Matt L. Nov 11 '19 at 19:07
• @Matt L. Yes that describes my Problem. But is there already a Python or Matlab implementation that fits to this procedure? – Andre Nov 11 '19 at 21:55

This is a very complicated problems and I don't think there exists a one-size-fits-all solution. You can try Matlab's $$invfreqz()$$ and see if it works for your purposes https://www.mathworks.com/help/signal/ref/invfreqz.html

In general this is a error minimization problem but the actual data and the way you set the your error function and the search strategy makes a huge difference in the outcome. Things to watch out for

1. How good is your data? What's the frequency coverage range, density and shape of frequency grid, signal to noise ratio, etc.
2. What do you care about in the result. Dips vs peaks ? Phase vs amplitude, ?
3. Stability and causality constraints. How do you deal with non-causalities in the data (real or noise induced)
4. Search space representation, search strategy & algorithms.
5. Error surface shaping and optimization.
6. Convergence tracking, stop criteria, metrics for success (or lack thereof)

I developed one of these that is optimized around the specific constraints and requirements of my application and found invfreqz() to be totally useless. Your mileage may vary.

• Thank you very much for your answer Hilmar. I will try the invfreqs function similar to the infvfreqz function you mentioned. The reason why i need the tf are very easy to explain. My purpose is to get poles and zeros to measure wheather there are some of them in the right half plane. And because of that i thought it would be easy by calculating when the denominator will be zero. – Andre Nov 15 '19 at 16:44