Oh I have completely forgotten the pivot. Thanks for reminder.
To share my further experience:
multiple POLY functions blur my data, so I just use one POLY to get 'reference data' which I use for acquiring p0 and p1 parameters. Then those are applied to data before POLY (and then it can be repeated).
For p0 the ideal parameter is straight forward: p0=arctan(-sum(idata)/sum(rdata))
Before that I filter out points with absolute value lower than threshold.
For P1 parameter 'for' loop is necessary.
I have trouble finding right evaluating function.
so, What do you think is good criteria for determination ideal phase parameters?