LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

implementing logarithmic sampling

Hello,
I have what is probably an easy question. I am quite new with labview and will appreciate someones help.
I am logging some data from a sensor using a cfieldpoint. Currently I log the data every 'x' milliseconds using a control which allows me to choose what 'x' is. I then write the time data and corresponding sensor data to a file.
However, I would like to implement a logarithmic sampling of the sensor data, so that the sampling is done on a logarithmic scale. How can I do this in labview?
0 Kudos
Message 1 of 14
(4,991 Views)
Hi RVR

I do not know if I understood you well but here is the example how to make the linear or logarithmic scale.

regards
Pawel
Message 2 of 14
(4,989 Views)
I am also not totally sure what you want to do with the data. If you want to graph it on a Logarithmic scale, I just created a very simply VI which outputs random data to a Chart that scales the y-axis logarithmically (is that a word???) 🙂
0 Kudos
Message 3 of 14
(4,989 Views)
Hello,

i read your post and would like to knwo if you got an answer to your question. I have the same problem and am new to using labview. Could you please let me know how to sample data logarithmically?

thanks
0 Kudos
Message 4 of 14
(4,960 Views)
I'm not aware of any NI hardware that will vary its sampling rate logarithmically. A previous answer suggested how you might simply display data on a log scale and that may be sufficient. The other alternative is to use the hw to take equally-spaced samples and then extract elements at log-spaced indices.

If you're dealing with something like a decay curve, you probably can just extract indices that are approximately log-spaced. A further refinement may be to interpolate values where integer-valued indices aren't sufficient.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 14
(4,948 Views)
thanks for the suggestion. The problem is that the application is a experiment where the curve decays rapidly at first so i need high sampling rates initially. Later on theres not much activitiy (although the sampling would go on upto about 4hrs). Initially i need about 50 microsecs to 100 microsecs sampling. Later on 1s or 10s sampling would do. Sampling at 50us throughout the whole 4hrs wouldnt make sense since it would lead to a tremendous waste of data.
It is possible for me to create a file containing the times at which i would need the data. Is there any way i could use this file to control a sampler connected to the Analog Input vi?

thanks in advance
0 Kudos
Message 6 of 14
(4,945 Views)
You could use a series of timed loops where each loop would take samples at different rates. The samples output from each loop could be concatenated together into one large data array. For example, timed loop #1 could sample at 50uS for a time period of 1 minute, then loop #2 could do the same sampling but at 5uS for 2 minutes, and so on...
- tbob

Inventor of the WORM Global
Message 7 of 14
(4,934 Views)
My solution to your problem would be to sample fast (you bought a fast card so use it), and then decimate the sampled data array and only save every N points, where N is a time varying function defined by your logrithmic function.

IE at first you save all points, then save every other point, then every third point, then every fourth point etc.

It's piecewise, but I garantee you if you are doing any interesting math on the data, you'll be a lot happier with uniformly (piecewise)sampled data rather than trying to recast functions into non-uniform (or god help you, random) sampling space.


I don't know of any way other than stopping sampling with a DAQ card to change the sample rate. But I really really like uniformly sampled data, and haven't looked at other solutions. You could use an external trigger and feed it a logrithmic decaying pulse train.

Sheldon
Technical geek, engineer, research scientist, biodegradable...
0 Kudos
Message 8 of 14
(4,781 Views)
thanks a lot for that idea. My final application would be a stand alone code or dll which would gather data in real time. Could some one please let me know if it is possible to do the following.

as suggested by the previous post i would wish take say 10000 samples at the rate of 100us per sample, then perhaps 1000 samples at 1ms per sample etc.

The above data rates are given by the user during runtime. I plan to store them in a file. Would it be possible to take these values from a file in each pass of a for loop and pass them to a sub vi which would use each pair of values once?
e.g the main vi has a for loop inside which is a sub vi. In the first pass through the for loop the sub vi would read 10000, 100 and would gather 10000 samples at a rate of 100 us ..and so on.

The whole vi would need to be built into a standalone executable. Is this feasible ?

thank you in advance,
0 Kudos
Message 9 of 14
(4,928 Views)
thanks a lot for that idea. My final application would be a stand alone code or dll which would gather data in real time. Could some one please let me know if it is possible to do the following.

as suggested by the previous post i would wish take say 10000 samples at the rate of 100us per sample, then perhaps 1000 samples at 1ms per sample etc.

The above data rates are given by the user during runtime. I plan to store them in a file. Would it be possible to take these values from a file in each pass of a for loop and pass them to a sub vi which would use each pair of values once?
e.g the main vi has a for loop, inside which is a sub vi. In the first pass through the for loop the sub vi would read 10000, 100 and would gather 10000 samples at a rate of 100 us ..and so on.

The whole vi would need to be built into a standalone executable. Is this feasible ?

thank you in advance,
0 Kudos
Message 10 of 14
(4,770 Views)