MATLAB: Transfer function estimation with unknown number of poles and zeros

discreteMATLABparametricSystem Identification Toolboxtfest

I have an input and output signal registered in time-domain (discrete).
With
sys = tfest(data,np,Ts);
I can estimate the transfer function given the number of poles. But I don't know how many poles/zeros my transfer function should have to best fit the data.
Is there a way that MATLAB can estimate the best transfer function without these constraints?
Thank you very much.

Best Answer

No, when using tfest you have to specify the number of poles and zeros.
If you are estimating state-space models, you can make use of the tool that helps you pick the order. See this example . You can then export identified state space model to MATLAB workspace and convert to a transfer function.