drbitboy
Lifetime Supporting Member
Agreed, @#2 by LD piecewise linear interpolation probably least amount of work and "good enough."
And this is what the overthinking side looks like, modeling a cone-on-cylinder shape with Radius = cylinder height = cone height. Fifth order is good around one percent. The sine approximation is good to 5-10%, but may not work on OP's data, and would need at least third order to get to the 1% level. Chebyshev may do better; splitting linear and non-linear sections into separate sections may end up being exact; simplicity of PLC not an issue for polynomials, but still probably not worth the extra effort if linear interpolation is good enough, even if code will be ugly.
And this is what the overthinking side looks like, modeling a cone-on-cylinder shape with Radius = cylinder height = cone height. Fifth order is good around one percent. The sine approximation is good to 5-10%, but may not work on OP's data, and would need at least third order to get to the 1% level. Chebyshev may do better; splitting linear and non-linear sections into separate sections may end up being exact; simplicity of PLC not an issue for polynomials, but still probably not worth the extra effort if linear interpolation is good enough, even if code will be ugly.