Page 1 of 1

oscilloscope filter data algorithm

Posted: Sat Mar 14, 2015 4:11 pm
by borodadada
Hello guys. The question of the theory than on practice. If I have one million samples, and screen size
1000 pixels wide. How do I display all the data that would not be the maximum and minimum losses? The end result of 1,000 samples.

Re: oscilloscope filter data algorithm

Posted: Sat Mar 14, 2015 7:17 pm
by Perfect Human Interface
Not certain where this came from but here's a wave player module that includes a waveform display written in Ruby.

Re: oscilloscope filter data algorithm

Posted: Sat Mar 14, 2015 8:14 pm
by borodadada
Yes, this is it. Thank you. But I have a poor knowledge of Ruby, in code,

Code: Select all

		0.upto(a.length-1) do |i|
			step += 1
			max = a[i] > max ? a[i] : max
			min = a[i] < min ? a[i] : min
			if step >= epp 
				maxA << [i*s,h-max*h]
				minA << [i*s,h-min*h]
				step = 0
				max = -1
				min = 1
			end
		end
Search max and min amplitude on interval (incloming 10 samples, search 2 (min and max))? Result one horizontal line? Ohh... :) Is it possible to make this algorithm in real time?