thanks for your reply what i what to do is replicate in st but for me is not easy and for have the same result i need to do all the stuf that polyfit doYes there is: Writing code to do Gaussian Elimination (actually Gauss-Jordan; see here; there is a flowchart that may be helpful for converting this to Ladder Logic) of a 4x4* array is probably the easiest way to replicate, on the PLC, the functionality of the Python numpy.polyfit routine to calculate the third-order polynomial coefficients to model a least-squares fit to the 5 to 10 [position, radius] pairs. It will be much easier with Structured Text, if that is available, but it can still be done with Ladder Logic. There are other, faster ways to factor the array, but they are more complex and would be harder to code and debug. With Gaussian Elimination, there are only a few operations: scaling a row; adding one (scaled) row to another; swapping rows, It might not be necessary to swap rows. The only problems will be an ill-conditioned array and numerical instability.
The time we lost waiting for the answer is small; the time you will spend, or that you pay someone to spend, coding that solution will not be small.
* When I wrote "3x3" earlier that was a mistake; I was forgetting the zeroth-order term.
thanks