07-05-2013 08:24 PM
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
Solved! Go to Solution.
07-06-2013 12:39 PM
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
07-06-2013 03:54 PM - edited 07-07-2013 02:05 AM
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.
07-06-2013 09:30 PM
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).
07-07-2013 03:07 AM
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.
07-07-2013 02:57 PM
ADrexelDragon What is the function used with next to the bottom loop and where is it? I can't find it anywhere :S
07-07-2013 03:04 PM
http://zone.ni.com/reference/en-XX/help/371361G-01/lvinstio/visa_bytes_at_serial_port/
Owning Palette: Serial VIs and Functions
07-07-2013 03:26 PM
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..
07-07-2013 04:03 PM
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.
07-07-2013 04:28 PM