01-26-2014 09:00 PM
Hello people, i have a array of data, im using histogram to see the frequency of data withing the array, i need to delete the data wthat has lower freq, for example, data with 1 to 5 frequency, any ideas how?, because histogram VI doesnt give you positions from data.
THank you, hope i made myself clear, if not, feel free to ask questions. Thank you again.
01-26-2014 09:07 PM
Hi yoko911,
Do you have a VI which I can refer to (the VI which you're working on)? And what do you mean by data with 1 to 5 frequency? Do you mean data with frequency of let's say 5Hz and below?
Warmest regards,
Lennard.C
01-26-2014 09:34 PM
Im ataching a LV example, noise statistics, the fron panel is:
As you can see by the image at the right, some data has a low frequency of apearance, i want to delete that data with low freq, so i can eliiminate some of the noise,
Thnak you
01-26-2014 11:52 PM
Hello, i've found a way to do this, in the image below, i have a control that deletes elements that apear at a frequency below, in the graph at the right u can tell, the red graph is the original, and the gray one is the cropped one, you can see that it was deleted a bar that was at 23 count.
Attached are the VI's used on this example, maybe this can be of help to some people, and if its posible, you can help expand or improve the code on the subVi, Im looking ways of improving the code, or cheking if there is any bug on it.
Thank you in advance.
01-27-2014 12:47 AM - edited 01-27-2014 12:47 AM
Hi yoko911,
Good to hear that you were able to come up with a solution. Can you explain your sub vi on what you have done? I did notice that when I increase the freq value, not only it shows the deleted bar but you can notice a value change in your histogram graph value. Is the histogram plot in grey supposed to be plot based on the reduced noise value?
Warmest regards,
Lennard.C
01-27-2014 03:07 AM
Lennard.C escribió:
Hi yoko911,
Good to hear that you were able to come up with a solution. Can you explain your sub vi on what you have done? I did notice that when I increase the freq value, not only it shows the deleted bar but you can notice a value change in your histogram graph value. Is the histogram plot in grey supposed to be plot based on the reduced noise value?
Warmest regards,
Lennard.C
Yes, Gray bar plot is after deleting values on the histogram.
First you use Histogram to obtain H(x) wich is the array with freq values, so i check if a value is greater than 0 and lower than my value, if i want to delete values that only apear once on my Arra In, i just put a 1 in Freq. (Frame is used just to encapsulate code for better explanation), in the frame i take 2 concecutive values of the X value array, which contains central values from the plot bar, since every value on Xvalues is the center, substracting 2 conecutive values gives me the range, in each iteration, i check if H(x) is greater than 0 and lower than Freq, is true, then i substract half range, and add half range so i have lower and upper limit from each H(x), using "In range" with my upper and lower value and using the original Array In, i have a boolean array wich is 1 on each value that is in range, then i convert to decimal 0 and 1 (just for convenience), and search for every 1 on the array, and creating an array of indexes, then with thata array of indexes, i replace those index with the mean value.
One thing im thinking about is taking one for loop since i use one to create a index array and then another to replace, maybe i can use only one to search and replace.
Any more questions feel free to ask.
01-27-2014 03:34 AM - edited 01-27-2014 03:38 AM
Hi yoko911,
In terms of refactoring, you can do something like below:
When you run the code and increase the freq value when the program is running, is the results as what you expected (i noticed the value change so i pressume that you want to plot the histogram value with the reduced noise)?
Warmest regards,
Lennard.C
01-27-2014 12:26 PM
The piece of code works as i want him to, i dont know what do you mean with:
When you run the code and increase the freq value when the program is running, is the results as what you expected (i noticed the value change so i pressume that you want to plot the histogram value with the reduced noise)?
01-27-2014 06:37 PM
Hi yoko911,
I was looking at the results when I change the freq value. I guess you're plotting the value before the noise reduction and after the noise reduction. No worries since it is working as how you want it.
Warmest regards,
Lennard.C