# IIR filter design fitting step response

I have access to the step response of a system and I want to find its poles and zeros without knowing the order of the system.

Consider an example of a step response of the system shown in the figure below. Here is the link to the raw data if someone wants to try it (https://pastebin.com/BpT4d9RW).

I want to build an IIR filter (with arbitrary number of poles and zeros) that has the same step response (or pretty close to it).

I have tried using the prny() function in MATLAB for that purpose, and the closest result I could get was the following. I am actually not sure what I am doing wrong here and if there are any considerations for using the prony() function that I am not aware of.

I would appreciate if someone can help me on correct use of the function OR can come up with some other approach that works.

Please also note that the approach should be general enough to accommodate any type of step responses (over-damped or under-damped).

• Apart from the scaling the step response doesn't look bad at all. What don't you like about it? – Matt L. Jul 20 '18 at 8:25
• The DC levels are different, and if I shift the DC level the peaking would be different. If I start with a step response of an analytical transfer function, I can get exactly the same step response. However in this case of simulated step response I don't know why there is DC offset and peak mismatch. This has probably something to do with the delay, cause it matters at which point you trim the the step (or impulse) response, and I am not sure why is that. – shampar Jul 20 '18 at 14:03
• You could post the code how exactly you compute the step response. I think it should be straightforward to solve the problem, but I might be wrong. – Matt L. Jul 20 '18 at 14:41
• I have uploaded three files in here, (one MATLAB .m file and two .csv files which contain the step responses): files.fm/u/ghw8pjj8. Let me know if there is any trouble in accessing the file. – shampar Jul 23 '18 at 21:26
• Or alternatively, you can create these three files yourself from the text and data that I pasted in the following link: pastebin.com/Wx08qyTz – shampar Jul 23 '18 at 21:38

I did that and found as optimal starting value for the step response an index of $530$ for a filter order of $2$. The figure below shows that the step response of the designed filter closely approximates the measured step response: