I am analyzing acoustic waveforms and I have used MATLAB to make a table for each test that calculates and lists several parameters (amplitude, peak frequency, duration, etc.) for each waveform. I want to compare these signals between different tests, and as a result, I want to summarize each of the parameters for each test. For example, I think it would be useful to compare the average duration of all 83 waveforms in Test 1 with the average duration of all 102 waveforms in Test 2. I can do this, but I've realized that the average isn't very useful for some parameters since the dataset has such a large range and some outliers disproportionately weigh the average.
So now instead of finding the average for each parameter, I want to find the values that are most prevalent.
For example, take this dataset (representing the duration in microseconds for 23 acoustic waveforms that occurred in one test).
duration = [212 61 276 213 188 62 212 275 214 212 32 62 62 250 63 61 96 77 64 32 62 213 64];
The average for this is 133. However, just by looking at the data (and confirmed via a histogram), it's clear that there are two values that are much more prevalent (around 212 and 62) than the rest, so the average of 133 doesn't really reveal much. I'm looking to write a script that automatically picks out these values that occur significantly more often than other values in the dataset. To simplify my question, let's say I only want my script to find the one value that occurs most often (in this case, 62).
To start with, my thought process was to make a histogram and then find the x-axis value of the bin with the highest intensity.
r = round(range(duration));
h = histogram (duration,r/4)
If you plot this histogram, it looks like the most prevalent value is in the bin that represents 60-64 microseconds. From there, I can just split the difference and say that 62 microseconds is the most prevalent duration in this set of waveforms.
I'm looking for the code that will give me this. I know it might not be the most statistically sound since within that bin, there might be an uneven distribution so that splitting it in half and saying 62 microseconds might not be the most accurate. But for my current purposes, that is okay.