LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

input and output

when I input different x values,VI should show me the corresponding y value(numeric indicator).Relation b/w x and y are previouly determined experimentally.
0 Kudos
Message 1 of 7
(3,169 Views)
What is your question. Is there some problem with your current vi? If you know the relationship between x and y there should be no problem in writing this program. If you're having a problem then perhaps you should give more details about the problem so that you can receive the help that you need.
0 Kudos
Message 2 of 7
(3,169 Views)
Thank you,John,I am a new user of Labview.My question is which specific math or input functions of labview6.1 to use to realize this task.Actually, the problem is very simple,but I just can't find the proper command to do it.
More clearly, the problem is:I know y=b1,b2,b3,b4 when x=1,2,3,4 based on my exp.Now,when I input x=2,I want the VI shows me y=b2.What is more,when I input x=1.6,I wish the VI can do interpration for me.
thanks a lot,John
0 Kudos
Message 3 of 7
(3,169 Views)
Create an 1D array containing your Y data: b0,b1,b2,b3,b4... (btw: You should start counting at zero instead of 1 for this, it makes everything much easier. The first element in an array has index 0, not 1).

To get the integer values, just use index array. If you want interpolated values, use "interpolate array", also in the array palette.

The attached code image show how to get element 4 (the 5th value if you start counting with 1), or the interpolated value for 2.4. (Of course you can use interpolate in both cases if you want).
0 Kudos
Message 4 of 7
(3,169 Views)
Of course if your x values are not spaced equally, this will not necessarily work. Still, it would not be too difficult to write a general interpolation routine for this more general case.
0 Kudos
Message 5 of 7
(3,169 Views)
thx a lot, Altecnbach! the interpolate array solved my problem finally.
At the same time, I suggest to first fit my original data into an equation using regression elsewhere (Matlab, etc) then, we can use the " math function" in labview to solve this problem, especailly for un-even x distribution.what do you think.
what is your "general interpolation routine" mentioned before?
thank you so much.
best
seawolf
0 Kudos
Message 6 of 7
(3,169 Views)
A simple linear interpolation for the case of randomly spaced x-values is quite trivial and there are many ways to do it. (I have attached one example in LabVIEW 7.0. In terms of code, it is probably the simplest and works as long as the raw data is sorted by increasing x). Of course you could also use a spline interpolation.
0 Kudos
Message 7 of 7
(3,169 Views)