02-06-2004 11:02 AM
02-06-2004 12:08 PM
02-06-2004 12:12 PM
02-06-2004 01:10 PM
11-30-2005 06:17 AM - edited 11-30-2005 06:17 AM
Message Edited by Warren Massey on 11-30-2005 04:18 AM
02-02-2006 12:51 PM
{50, 50, 50, 50, 51, 51, 51, 51, 51, 100}
02-03-2006 06:40 AM
@mlloyd wrote:
Warren,I tried your VI. It works when the range of numbers in the dataset is small. However, when I try it with my dataset{50, 50, 50, 50, 51, 51, 51, 51, 51, 100}the modal value returned is 50, not 51. I would assume that this is because of the way the intervals work for the histogram... Perhaps if you add in some sort of factor that accounts for the range of values in the array instead of just looking at the array size you would get better results for datasets with large ranges.Regards,Michelle
You are right that it does appear to be incorrectly sensitive to this type of data.
You are also correct that the problem lies with how the intervals are chosen.
My first thought on how to fix it was to just allow one interval for each integer value between the max & min values in the array but this can result in too many intervals if the separation is large.
My second thought was to dump the Histogram function and its problematic interval-picking problem and just count the occurrences of each value found in the array. That was the basis for the attached Modal_Value_I vi that is attached.
It then occurred to me that since the values being analyzed were floats, there really needed to be some tolerance associated with the part of the VI that searched for like values, and from that, Modal_Value_II was born.
There is no doubt still room for improvement since Modal_Value_II doesn't report out the center value within the intervals it develops (it instead reports out the first value it found in the array that was subsequently used to develop the new interval) but I'll leave that refinement for another day or another person.
The VI's are LV v7.1.1.