10-14-2019 03:08 PM
Hello together, I'm using a Keithley 2700 to acquire measurement values sequentially on 6 channels (sampling frequency of the entire array approx. 5 Hz) and in parallel I'm using a NI PIC-6133 to acquire another 2 channels with a sampling rate of several kHz. Due to the sequential sampling of the Keithley each channel has its own time stamp, the simultaneously sampled channels of the 6133 another. I would now like to interpolate these raw data in such a way that there is only one time stamp for each acquisition of the measured values. Additionally I want to reduce the sample rate, e.g. by specifying a different sample rate.
Current raw data:
Keithley_Value_A; Timestamp_A
Keithley_Value_B; Timestamp_B
Keithley_Value_C; Timestamp_C
Keithley_Value_D; Timestamp_D
Keithley_Value_E; Timestamp_E
Keithley_Value_F; Timestamp_F
6133_Value_G1; 6133_Value_G2; Timestamp_G
Desired interpolation and downsampling:
Keithley_A_new; Keithley_B_new; Keithley_C_new; Keithley_D_new; Keithley_E_new; Keithley_F_new; 6133_Value_G1_new; 6133_Value_G2_new; Timestamp_new
Is there a suitable interpolation function in LabVIEW that I can use to do this? Can anyone give me an example?
Many thanks for ideas and tips,
Michael.
---------------------------------------------
LabVIEW 2016 (PDS)
Windows 10
NI-PCI 6133
Keithley 2700 with GPIB
Solved! Go to Solution.
10-14-2019 08:03 PM - edited 10-14-2019 08:21 PM
You can probably do this using a combination of Interpolate 1D Array and Threshold 1D Array. The basic idea would be to find out what fractional index of your original array is needed to get the desired time (using Threshold) then interpolate the values array using Interpolate.
I'd just caution you to be careful given the quite different sample rates about how you interpret your output - it may not really be "true", for example.
Below is an example showing this. Note that the last few points (in both cases really, but more noticeable in the slow -> medium case) are not even vaguely valid...
If you wanted to do more complicated interpolation (this is just linear) you can find VIs to do that under the Mathematics palette. The VI used here is the similarly named Interpolate 1D.
In this case, offset is set to 0 to better display the closeness of matching. "cubic Hermite" looks good for this set (sine, cosine) but the method probably depends on the input and perhaps your available time.
10-18-2019 11:49 AM
Hello cbutcher,
I implemented your second example. With an artificial dataset it works very well. If I use a real dataset with an array size greater than 22049 values, no calculation will be performed. Do you have an explanation?
You can find my example in the appendix. The array has 27460 values for X and Y respectively. The calculation works up to 22049 values. If you increase the array length by one to 22050, no interpolated curve will be calculated. Why?
Many thanks for a tip.
Greetings Michael
10-18-2019 12:18 PM
How odd! I can't look at this right now but I'll take a look when I get a chance.
In the mean time, does the "error" output from the interpolate VI return anything?
You can use Error Cluster from Error Code to get a normal error cluster from the number it returns.
10-18-2019 03:04 PM
There is an error code being returned from the 1D Interpolate, -20145: "Each independent variable must contain the same number of values as the dependent variable."
It turns out your Y array has 27460 elements and your X array has 22459 elements. You don't get a graph because the Interpolation block errors out due to a lack of X data.
10-20-2019 08:44 AM
As MHawk nearly said, your Y array in the cluster (at least as it was attached) has 22049 elements.
As a result, the array subset makes them the same length when you have fewer than that number requested, but makes the X array longer than Y when you set a larger value.
Wiring Error Code to Error Cluster after the Interpolate describes this issue and allows you to catch it in your application and do something for the user (prompt, throw error, use the shorter length, etc).