LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get X Data from Y (t0) Waveform Graph

Solved!
Go to solution

Hi Guys,

 

I have spent a day or two trying to figure this out... I have a waveform graph with 64000 data points over a period of 1 second (64kHz). I am then attempting to get a sample from this waveform at 128kHz. So from my understanding that means from a specfic time value (on the X Axis) I need something that will return the corresponding Y Axis Value. Interpolation may be needed as the value on the X Axis may not exist in the WaveForm array.

 

Does anyone have any idea how to go about this?

 

Cheers,

 

Alex

0 Kudos
Message 1 of 11
(5,338 Views)

Alex,

 

Look at the Resampling VIs in the Signal Processing >> Waveform Conditioning palette. One of those may be able to do what you want.

 

Lynn

0 Kudos
Message 2 of 11
(5,306 Views)

AlexC1231 wrote:

I have spent a day or two trying to figure this out... I have a waveform graph with 64000 data points over a period of 1 second (64kHz). I am then attempting to get a sample from this waveform at 128kHz. So from my understanding that means from a specfic time value (on the X Axis) I need something that will return the corresponding Y Axis Value. Interpolation may be needed as the value on the X Axis may not exist in the WaveForm array.


So, you want to get a single Y point from a potentially fractional array index of the waveform data. I don't understand the 128kHz part. Do you mean halfway between existing values? (If you want to resample the entire waveform, use Lynn's suggestion above). Also note that you post title seems to describe the opposite: getting x data from y. Please explain.

 

LabVIEW has several tools to easily do all that, but please be a bit more specific and maybe attach some sample code containing typcal data.

0 Kudos
Message 3 of 11
(5,298 Views)

You could take the 64000 data points and interpolate between each point.

Use the 64000 data points as a lookup table. See example.

The top for loop is 5 datapoints... I want 10 datapoints (bottom for loop).

 

test1.png

CLD Certified 2014
0 Kudos
Message 4 of 11
(5,285 Views)

Johnsold - Thanks for the suggestion, I will have a look at that today, but from a quick glance that seems to be the entire waveform. Am I correct in assuming that would be rather costly?

 

altenbach - "So, you want to get a single Y point from a potentially fractional array index of the waveform data" That is correct yes. The 128kHz part is me trying to sound technical, what I mean is I will need to get 128000 samples per second. It does seem that my title is the wrong way around, is there anyway to change it? I do apologies! I can't attach any data due to confidentiality, however typical data ranges from 0 to 450 with one or two major spikes, the average of the data is generally around 100 but as mentioned it does spike to higher numbers.

 

ADrexelDragon - Thanks for the suggestion, that looks quite interesting. 

0 Kudos
Message 5 of 11
(5,268 Views)

ADrexelDragon What is the function used with next to the bottom loop and where is it? I can't find it anywhere :S

0 Kudos
Message 6 of 11
(5,248 Views)
0 Kudos
Message 7 of 11
(5,245 Views)

I think it is interpolate 1D.vi, from the "mathematics...interpolation palette". (Nothing to do with serial...)

 

Also note that the above png picture is actually a LabVIEW 2012 code snippet, meaning you can drop it onto the diagram and it will magically turn into functional code. Try it if you have LabVIEW 2012..

0 Kudos
Message 8 of 11
(5,238 Views)
Solution
Accepted by topic author AlexC1231

AlexC1231 wrote:

altenbach - "So, you want to get a single Y point from a potentially fractional array index of the waveform data" That is correct yes. 


Well, then you don't need to generate the entire interpolated waveform, all you need is extract a single point. Interpolate array will do that for you. For 1D array inputs, you wire the fractional index (which in your case would have a .5 as fractional part, easily calculated from your time values).

 

However, you can also wire an array of points (cluster of x, y) and it will do the rest for you. 😉 Attached is a simple example.

 

 

Message 9 of 11
(5,227 Views)
Yes I used the 1D interpolation to generate in between data points. I posted the wrong function before. Sorry about that.
CLD Certified 2014
0 Kudos
Message 10 of 11
(5,218 Views)