01-22-2013 05:00 PM - edited 01-22-2013 05:06 PM
I have some data collected at 1683 Hz (yes, that was what I had!) and would like to reduce the sampling rate to some meaningful number, say 1024, 500, 400, or similar.
What should I do?
01-23-2013 03:01 AM
Hello Zhi_lu,
could you please provide an example of your data? One channel is enough.
01-23-2013 08:35 AM
You can try with any data, as long as you can adjust the sample rate, that is: reduce or increase number of data points for the same waveform.
01-23-2013 08:45 AM
Last year I did the similar recalculation with following code:
Option Explicit dim i, k(3), n(2), freq(2) ' freq(0) = 1/Data.Root.ChannelGroups(1).Channels(1).Properties("wf_increment").Value freq(1) = 20 ' here set the new (requested) frequency in Hz ' n(0) = Data.Root.ChannelGroups(1).Channels(1).Size n(1) = freq(1)*n(0)/freq(0) ' Dim oCh : Set oCh = Data.Root.ChannelGroups(1).Channels ' for i = 1 to oCh.Count k(1) = oCh(i).Properties(1).Value k(2) = oCh(i).Properties(2).Value k(3) = oCh(i).Properties(3).Value Call ChnSplineXYCalc("",ChnName(i),"",ChnName(i),"approximating","Partition complete area",n(1),1,1) oCh(i).Properties(1).Value = k(1) oCh(i).Properties(2).Value = k(2) oCh(i).Properties(3).Value = k(3) next
Hopefully it helps.
01-25-2013 04:14 PM - edited 01-25-2013 04:19 PM
Thank you! Could you please add some comments and explain what you were doing, especially why do channel property swapping near the end? I am a beginner with coding..........
01-28-2013 12:53 AM
Well, the calculation is the approximation of your channel (variables with index 0) to a new one (index 1).
The freq(0) and freq(1) are the sampling frequencies for the channels for the case you have waveform channels.
The n(0) and n(1) are the numbers of the data points inside the channels. The new created channel should have the number n(1), calculated from n(0) with regard to different sampling ratios.
The real code is the line Call ChnSplineXYCalc(..... The properties swapping can be commented out, but then the new channel would have a "system name", something like "Approximated XY", and the same for description and units... Probably one can avoid it by changing of settings, but I use to do it by code.
In short, here you copy the properties from the "old" channel and paste them to the new one.
02-12-2013 05:56 PM
Hi ULIHZ,
I think the simplest solution would be to create the new Time channel you want with the 1kHz or whatever sampling rate using the ANALYSIS function "Generate Numereric Channel" function in the "Channel Functions" palette. Then use the ANALYSIS function "Linear Mapping" in the "Curve Fitting" palette to resample the measured data to the desired new Time channel.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-14-2013 03:36 PM - edited 02-14-2013 03:37 PM
Thanks Brad! I will give it a try.
02-14-2013 04:28 PM
I can generate a time channel and map the data file to that channel, but the results was keeping every point in the data channel rather than removing some of the over sample values.
Did I do something wrong?
02-18-2013 05:06 PM
Hi ULIHZ,
Make sure that the Time channel you create has the desired number of points you want the resampled channel to have.
Brad Turpin
DIAdem Product Support Engineer
National Instruments