# Designing a feature vector for discriminating between different sonic waveforms

Consider the 4 following waveform signals:

signal1 = [4.1880   11.5270   55.8612  110.6730  146.2967  145.4113  104.1815   60.1679   14.3949  -53.7558  -72.6384  -88.0250  -98.4607]

signal2 = [ -39.6966   44.8127   95.0896  145.4097  144.5878   95.5007   61.0545   47.2886   28.1277  -40.9720  -53.6246  -63.4821  -72.3029  -74.8313  -77.8124]

signal3 = [-225.5691 -192.8458 -145.6628  151.0867  172.0412  172.5784  164.2109  160.3817  164.5383  171.8134  178.3905  180.8994  172.1375  149.2719  -51.9629 -148.1348 -150.4799 -149.6639]

signal4 = [ -218.5187 -211.5729 -181.9739 -144.8084  127.3846  162.9755  162.6934  150.8078  145.8774  156.9846  175.2362  188.0448  189.4951  175.9540  147.4631  -89.9513 -154.1579 -151.0851] We notice that signal 1 and 2 look similar and that signal 3 and 4 look similar.

I am looking for an algorithm that take as input n signals and divide them into m groups, where the signals within each group are similar.

First step in such an algorithm would usually be to calculate a feature vector for each signal: $\mathbf{F}_i$.

As an example we might define the feature vector to be: [width, max, max-min]. In which case we would get the following feature vectors:

$\mathbf{F}_1 = [13,146,245]$

$\mathbf{F}_2 = [15,145,223]$

$\mathbf{F}_3 = [18,181,406]$

$\mathbf{F}_4 = [18,189,408]$

The important thing when deciding on a feature vector is that similar signals get feature vectors that are close to each other and dissimilar signals gets feature vectors that are far apart.

In the example above we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 22.1, |\mathbf{F}_3 - \mathbf{F}_1 | = 164.8$

We could therefore conclude that signal 2 is much more similar to signal 1 than signal 3 is.

As feature vector I might also use the terms from the discrete cosine transform of the signal. The figure below shows the signals along with approximation of the signals by the first 5 terms from the discrete cosine transform: The discrete cosine coefficients in this case are:

F1 = [94.2496  192.7706 -211.4520  -82.8782   11.2105]

F2 = [61.7481  230.3206 -114.1549 -129.2138  -65.9035]

F3 = [182.2051   18.6785 -595.3893  -46.9929 -236.3459]

F4 = [148.6924 -171.0035 -593.7428   16.8965 -223.8754]


In this case we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 141.5, |\mathbf{F}_3 - \mathbf{F}_1 | = 498.0$

The ratio is not quite as large as for the simpler feature vector above. Does this mean that the simpler feature vector is better?

So far I have only shown 2 waveforms. The plot below show some other waveforms that would be the input to such an algorithm. One signal would be extracted from each peak in this plot, starting at the nearest min to the left of the peak and stopping at the nearest min to the right of the peak: For instance signal3 was extracted from this plot between sample 217 and 234. Signal4 was extracted from another plot.

In case you are curious; each such plot corresponds to sound measurements by microphones at different positions in space. Each microphone receive the same signals but the signals are slightly shifted in time and distorted from microphone to microphone.

The feature vectors could be sent to a clustering algorithm such as k-means that would group together the signals with feature vectors close to each other.

Do any of you have any experience/advice on designing a feature vector that would be good at discriminating waveform signals?

Also which clustering algorithm would you use?