# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

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

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?

Message 1 of 14
(5,111 Views)

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

Yes, there is a function: Interpolate1DArray…

Best regards,
GerdW

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

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

@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,105 Views)
Solution
Accepted by avater

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

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).

Message 4 of 14
(5,093 Views)

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

Oh, that's a neat trick!

Cheers

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

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

Message 5 of 14
(5,091 Views)

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

Thanks very much!

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

Message 6 of 14
(5,089 Views)

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

@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.

Message 7 of 14
(5,084 Views)

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

@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.).

Message 8 of 14
(5,073 Views)

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

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)?

Message 9 of 14
(5,069 Views)

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

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

Message 10 of 14
(5,065 Views)