ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

logarithmic decimator?

Hi,
 
I am displaying an array of 1 million points (linearly spaced) on a graph with a logarithmic axis. That's a lot of points, and my program slows down consequently. Also, the points bunch up on the right side of the scale, so i can't see multiple graphs properly.
 
Solution: I would need a logarithmic decimator, to take a subset array from the original, with logarithmically spaced data points. That way, my data will look evenly spaced on a logarithmic graph.
 
Anyone have a subvi which will do this? Any suggestions for an algorithm that will do this?
 
Thanks
aleks.
0 Kudos
Message 1 of 5
(3,231 Views)
do a for loop log10(array size) get 10^i item and index it out.  This should index out 0, 10, 100,1000,10000, 100K and 1M element and run very fast.  I think this should work.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(3,223 Views)
I've effectively implemented the same thing in a subvi just a moment ago.
 
It's  a while loop which runs, and creates an array of indices to remove from the original array. The algorithm is
 
INDEX_TO_REMOVE = LAST_INDEX_REMOVED - round(1.01^i)
 
LAST_INDEX_REMOVED starts at ARRAY_SIZE
1.01 is a fraction to be fine tuned
"i" is the while loop index.
 
The part which takes a long time is remove the entries one by one... i still need help with that.
 
I guess what you suggested simply keeps entries, whereas i've been removing them. I'll try to reverse my method, to reduce the time it takes.
 
Thanks   
0 Kudos
Message 3 of 5
(3,215 Views)
Here is what i was thinking, will give you the the solution in O(Log(n)) time very fast. 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 5
(3,194 Views)
Oops forgon thew attachment
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(3,192 Views)