I have a sample graph like one below.., which I plotted with set of (x,y) values in an array X.
http://bubblebird.com/images/t.png
As you can see the image has dense peak values between 4000 to 5100
My exact question is can I programmatically find this range where the graph is most dense?
ie.. with Array X how can I find range within which this graph is dense?
for this array it would be 4000 – 5100.
Assume that the array has only one dense region for simplicity.
Thankful if you can suggest a pseudocode/code.
You can use the variance of the signal on a moving window.
Here is an example (see the graph attached where the test signal is red, the windowed variance is green and the filtered signal is blue) :
test signal generation :
compute moving window variance :
get the indices where the variance is high (here I choose the criterion variance superior to half of the maximum variance… you can adapt it to your case) :
or filter the signal (set to zero the points with low variance)