rfa_fit_dev

Find best fitting RFA approximation from frequency response Yv over the frequency range kv for both continuous (ds=None) and discrete (ds>0) LTI systems.

The RFA approximation is found through a 2-stage strategy:

a. an evolutionary algoryhtm is run to determine the optimal fitting coefficients b. the search is refined through a least squares algorithm.

and is stopped as soon as:

1. the maximum absolute error in frequency response of the RFA falls below TolAbs 2. the maximum number of iterations is reached.

Input: - kv: frequency range for approximation - Yv: frequency response vector over kv - TolAbs: maximum admissible absolute difference in frequency response between RFA and original system. - Nnum,Ndem: number of coefficients for Pade approximation. - ds: sampling time for DLTI systems - NtrialMax: maximum number of repetition of global and least square optimisations - Cfbouds: maximum absolute values of coeffieicnts (only for evolutionary algorithm) - OutFull: if False, only outputs optimal coefficients of RFA. Otherwise,

outputs cost and RFA coefficients of each trial.

Output: - cnopt: optimal coefficients (numerator) - cdopt: optimal coefficients (denominator)

Important: - this function has the same objective as fitfrd in matwrapper module. While generally slower, the global optimisation approach allows to verify the results from fitfrd.