02-03-2016 02:53 PM
Greetings, I need to make a VI that linearizes a non linear characteristic (output signal of a sensor) using piecewise method. I have no idea how to start and what to use. Any help or advice would be appriciated. Thanks.
02-03-2016 03:01 PM
You could use the case structure. It can accept integers to select and you can setup a case to use ranges. So what I have done for something similar is multiply the value by 1000 (or however accurate you want your peicewise to be) and cast to an integer. You can then use that for the case structure. The rest is just a matter of what math to do in which case.
02-03-2016 03:47 PM
02-03-2016 04:14 PM - edited 02-03-2016 04:14 PM
Interpolate 1-D array and Threshold 1-D array are useful functions to linearize data piecewise in a lookup table fashion.
02-03-2016 05:52 PM
Thanks for the reply guys. Here is what I made (so far). The graph on the right is a simple characteristic i want to linearize and after the linearization it should display on the left one. In the array I want to set the boundaries which part of the characteristic i need to linearize (for example 0-5, 5-20,20-50)...
02-03-2016 05:58 PM
Just calculate the function at the switch points and use "interpolate array" on the cluster array to get any linearly interpolated value.
02-03-2016 06:27 PM
Thanks for the suggestion but It needs to work on any non linear function without me having to calculate the switch points. This is just an expample I made.
02-03-2016 07:06 PM
You can't create a piecewise function unless you come up with a way to determine where those pieces exist. If you don't do it for some arbitrary function, then how do you expect to get it done?