LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Define a point in a discrete XY graph.(Correction curve)

Solved!
Go to solution

I have a XY graph which is consist of discrete points.Like

X        Y

100    1.2

150     2.3

200    1.5

250    2

300    1.8

 

This is usually used as a correction curve,which shows a trend of the a Y value for a specific X.

OK,I have a new X but not in the XY graph points.For example X= 210.So how much should I get according to this XY graph?

Is there any functions in Labview to get it?

0 Kudos
Message 1 of 14
(5,142 Views)

Yes, there is a function: Interpolate1DArray…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(5,140 Views)

@GerdW wrote:

Yes, there is a function: Interpolate1DArray…

 


This only works with even X spacing for your reference data, which it seems you have. If you have something slightly more complicated, you can use the Linear Fit VI from the Mathematics > Fitting palette.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 3 of 14
(5,136 Views)
Solution
Accepted by avater

If you represent the data as an array of points (cluster of x,y), you can use interpolate array and the spacing does not need to be equal.

 

Try this.

 

 

(you can even get the cursor x position from the event data node, but then you cannot combine with the timeout event to set everything before the cursor is moved for the first time).

Download All
Message 4 of 14
(5,124 Views)

Oh, that's a neat trick!

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 14
(5,122 Views)

Thanks very much!

Another thing is that how to add a correction curve to a XY graph?

0 Kudos
Message 6 of 14
(5,120 Views)

@avater wrote:

Thanks very much!

Another thing is that how to add a correction curve to a XY graph?


Where do you get it from? Do you have a file?

 

Typically you would read it as a 2D array of DBL first. then you can slice out the frst and second row/colum as 1D arrays and wire these to a bundle node (x on top). To get a 1D array of points, wrap an autoindexing FOR loop around the bundle node.

0 Kudos
Message 7 of 14
(5,115 Views)

@James.M wrote:

Oh, that's a neat trick!


The problem is that I typically use complex arrays for XY graphs. Thus this idea. (Please vote for it! :D)

 

Maybe interpolate 1D array should accept all data types that can represent a plot in an xy graphs (1D array of points, cluster of 1D x and y arrays, complex 1D array, etc.).

 

See also the various links on the idea for futher discussion.

0 Kudos
Message 8 of 14
(5,104 Views)

You are really a kind and nice person!

My case is I have 2 waveforms(wav1 and wav2) and I want to have another wavform(wav3,I called it as correction curve ).So wav1 + wav3 = wav2.How to get this wav3?

 

The other case is that I have wav1 and wav3,how to get wav2(corrected curve)?

 

 

0 Kudos
Message 9 of 14
(5,100 Views)

Please attach your VI containing typical data.

 

(XY graphs are normally not used to graph waveform data (special datatype), so obviously we are missing crucial information)

0 Kudos
Message 10 of 14
(5,096 Views)