LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding a Y value for a given X value?

Solved!
Go to solution

I have a small list of given x values and a large set of points in a cluster.  I am trying to find the corresponding y values to the given x values.  I tried using the interpolate 1d array function before I bundled the cluster but that did not give me the correct y values.  I'm new to labview and any help would be much appreciated.  Thanks.

0 Kudos
Message 1 of 13
(4,536 Views)

Attach your VI so we can see you tried to interpolate 1-D array, then we'll be able to show you how to fix it.

0 Kudos
Message 2 of 13
(4,530 Views)

Here is the VI I usedasdf.JPG

0 Kudos
Message 3 of 13
(4,523 Views)

If you use interpolate array with an array of points, you get a linearly interpolated y value for x values that don't exist in the array of points. If you get something unexpected, show us your code. Make sure it contains typical data.

0 Kudos
Message 4 of 13
(4,521 Views)

@chazzchuzz wrote:

Here is the VI I usasdf.JPG


That's not a VI, but a picture. Please attach the actual VI.

Also, where is the cluster you mentioned earlier?

0 Kudos
Message 5 of 13
(4,517 Views)

Sorry about that.  Here is the VI.  Plasma emisions is the y coordinate of the cluster.  Right now it is just an array, there is a cluster containing the emissions and the x coordinate in a different VI.  I thought interpolate 1d array would work for getting the y value but it gives me the wrong value.  Here is a snapshot of the file where the x and y coordinate lists came from.  For x=800.62, I should be getting a value in the two thousands but I am getting something around -14.  Thanks so much for the help.Plasma emissions.JPG

0 Kudos
Message 6 of 13
(4,488 Views)

We can't run your VI because you haven't included any of the data as default.

 

But looking at your VI, it looks like you are missing the Threshold 1D array.  That will give you the fractional index of where 800.62 fits within your X array.

 

Then you apply that factional index into the Y array to find the corresponding Y value.

0 Kudos
Message 7 of 13
(4,484 Views)

Wouldn't I need a y value in the first place to use the threshold function?

0 Kudos
Message 8 of 13
(4,477 Views)
Solution
Accepted by topic author chazzchuzz

No.

 

You use your 800.62 into the threshold function on the X array.  That gives you a fractional index.

 

Then you put that fractional index into Interpolate 1-D array acting on the Y array.  Now you have the interpolated point out of the Y array.

Message 9 of 13
(4,471 Views)

It worked!  Thanks a ton.

0 Kudos
Message 10 of 13
(4,467 Views)