Non linear analog input - measuring distance

Hi, what is the best way to implement analog input with non linear characteristic? I want to measure distance with Sharp GP2Y0A41SK0F sensor, then use this measurment to position leadscrew nut. I am using Automation Studio 4.12

Hello Bar,

in such a case, I use the “MTLookUpTable” function block to linearize the characteristic curve.

MTLookUpTable

Regards

Stephan

4 Likes

I think it could be necessary to limit the table to the red curve since the values below 3 cm are not clearly assignable:

3 Likes

Depending how accurate the values in between the points need to be you could also use ‘polynomial fitting’ .

The sample uses the Gauss Elimination within a function which gets the same results if you put it in Excel.

PolynomialFitting.zip (136.4 KB)

3 Likes

Yeah that is true, producer says it measures 4-30 cm :slight_smile:

If I can create my own arrays, I think it would be best solution, but I can’t find this function block unfortunately using AS 4.12.6.106

Hello,
Please search without a filter. It’s under mapp control using AS4.12.8.41.

1 Like

Maybe I need newer version of AS or student license is not including this function

Hi there,

try installing it :slight_smile:

Also please note that the AS license doesn’t remove functionality, so any time you don’t find something, it’s not your license. It might limit usage, but not hide a function from you:

Thank you, solution was very easy, but still didn’t think of it, thank you :smiley: