02-25-2006 01:22 PM
02-25-2006 02:48 PM
02-25-2006 02:49 PM
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-25-2006 03:00 PM - edited 02-25-2006 03:00 PM
Sure, here are the guts of the code. The loop on the left creates the lookup table.
entering a current level will calculate the fractional index, then return the corresponding value from the x array. The "current value" output is basically the "current level" input coerced to the valid y-range of the lookup table.
Note that threshold and interpolate do a linear interpolation only. It is also required that the function increases monotonically, if not there will be multiple solutions and it would need extra code to get them all. 😉
Message Edited by altenbach on 02-25-2006 01:00 PM
02-25-2006 03:03 PM
02-26-2006 12:43 AM
02-26-2006 12:48 AM
02-26-2006 03:33 AM
I cannot test your VI because you did not include the subVIs. Please save everything in an llb.
You don't need to place the lookup table generation in a different subVI and wire the two arrays. You can use my solution directly. The lookup table will only be generated the first time the VI is called, just wire the desired inputs and outputs. You can even generate the table at the very beginning, by placing another instance of the subVI before the while loop and discarding the output.
Please get rid of your stacked sequence structure. It servers no purpose because there is complete data dependency. It only clutters the diagram, hides code, and forces backwards wires. This is bad form! 🙂 (Convert it to a flat sequence, then remove the sequence).
02-26-2006 11:30 AM
02-26-2006 07:45 PM