LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

centre line from 2 plots on an XY graph unevenly sampled

Hi Guys

Trying to find a way to plot the middle line of a multi plot XY graph. The plots don't start from 0 and are unevenly sampled, what I need to be able to do is at every 0.1 x (for example) look at the bottom curve and take a y value and then look at the upper curve and take a y value, subtract these and plot the middle point.

Ive tried various things, interpolation requires x information from 0 at a constant iteration i.e. 1, 2 ,3 etc.

What would solve the problem is being able to programmatically place a cursor at an x axis and read back the two associated y values. The problem with the cursors is that they snap to point, not any point along the line.

Any ideas??

Thanks

Paul
0 Kudos
Message 1 of 3
(2,518 Views)
> Trying to find a way to plot the middle line of a multi plot XY graph.
> The plots don't start from 0 and are unevenly sampled, what I need to
> be able to do is at every 0.1 x (for example) look at the bottom curve
> and take a y value and then look at the upper curve and take a y
> value, subtract these and plot the middle point.
>
> Ive tried various things, interpolation requires x information from 0
> at a constant iteration i.e. 1, 2 ,3 etc.
>
> What would solve the problem is being able to programmatically place a
> cursor at an x axis and read back the two associated y values. The
> problem with the cursors is that they snap to point, not any point
> along the line.
>

You are looking to interpolate or resample your data. There are many
ways to
do this, and you will have to decide which makes the most sense
for what your data represents. Simplest is linear. Simply average the
two points, polymorphism works well here, and that will produce the
midpoint for two points. Loop as many times as is appropriate over your
existing array building a new array. If a different type of
interpolation makes more sense you can do anything from doing a curve
fit of the data and sampling the polynomial wherever you like, to using
N adjacent points to build up splines and interpolating to the spline,
to using sine wave segments. Many of these have been discussed in past
postings. Try searching for resampling or interpolation.

Greg McKaskle
0 Kudos
Message 2 of 3
(2,518 Views)
Rawly wrote:
> Hi Guys
>
> Trying to find a way to plot the middle line of a multi plot XY graph.
> The plots don't start from 0 and are unevenly sampled, what I need to
> be able to do is at every 0.1 x (for example) look at the bottom curve
> and take a y value and then look at the upper curve and take a y
> value, subtract these and plot the middle point.
>
> Ive tried various things, interpolation requires x information from 0
> at a constant iteration i.e. 1, 2 ,3 etc.
>
> What would solve the problem is being able to programmatically place a
> cursor at an x axis and read back the two associated y values. The
> problem with the cursors is that they snap to point, not any point
> along the line.
>
> Any ideas??
>
> Thanks
>
> Paul

Can't you just
use 'Interpolate 1D Array' in a loop for each curve? It
seems easy to me. 'Interpolate 1D Array' can take an array of points
and the sample interval does not have to be constant. Its located on the
array palette
0 Kudos
Message 3 of 3
(2,518 Views)